Skip to content

Commit

Permalink
BHC Energy Hatch Limit and Parallel Calculations, Green TecTech Hatch…
Browse files Browse the repository at this point in the history
… Tooltip (#3843)

Co-authored-by: Mary <[email protected]>
Co-authored-by: Maya <[email protected]>
  • Loading branch information
3 people authored Jan 21, 2025
1 parent 98426a7 commit d952452
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/main/java/gregtech/api/util/GTUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,12 @@ public static byte getOppositeSide(ForgeDirection side) {
.ordinal();
}

/**
* Gets the voltage tier corresponding to an amount of EU, capped to 15 (MAX+)
*
* @param l The amount of EU
* @return Corresponding voltage tier in the range 0-15
*/
public static byte getTier(long l) {
if (l > V[14]) return 15;
if (l <= V[0]) return 0;
Expand All @@ -460,6 +466,18 @@ public static byte getTier(long l) {
return (byte) ((log2L - 2) / 2);
}

/**
* Gets the voltage tier corresponding to an amount of EU
*
* @param l The amount of EU
* @return Corresponding voltage tier
*/
public static int getTierExtended(long l) {
if (l <= V[0]) return 0;
int log2L = 64 - Long.numberOfLeadingZeros(l - 1);
return ((log2L - 2) / 2);
}

public static long getAmperageForTier(long voltage, byte tier) {
return ceilDiv(voltage, GTValues.V[tier]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public MultiblockTooltipBuilder addOtherStructurePart(String name, String info,
* @return Instance this method was called on.
*/
public MultiblockTooltipBuilder addTecTechHatchInfo() {
iLines.add(EnumChatFormatting.BLUE + TT_tectechhatch);
iLines.add(EnumChatFormatting.GREEN + TT_tectechhatch);
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ public static String buildMagnetTooltip(MagnetTiers m) {
if (m.supportsExotic) tooltip = tooltip + "/n "
+ EnumChatFormatting.BOLD
+ EnumChatFormatting.GREEN
+ "Can Use Multiamp Hatches";
+ "Can Use Multi-Amp Hatches/n "
+ EnumChatFormatting.RED
+ "Limit to one energy hatch if using Multi-Amp";

return tooltip;
}
Expand Down Expand Up @@ -214,7 +216,7 @@ protected MultiblockTooltipBuilder createTooltip() {
.addInfo("Use screwdriver to switch mode")
.addInfo("Insert an electromagnet into the electromagnet housing to use")
.addInfo("Better electromagnets give further bonuses")
.addInfo("With Tengam electromagnet, multiamp (NOT laser) hatches are allowed")
.addInfo("With Tengam electromagnet, multi-amp (NOT laser) hatches are allowed")
.beginStructureBlock(7, 6, 7, false)
.addController("Front Center")
.addCasingInfoMin("MagTech Casings", MIN_CASING, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ protected MultiblockTooltipBuilder createTooltip() {
.addInfo(
EnumChatFormatting.RED
+ "Recipe tier is limited to hatch tier + 1. Will not perform overclocks above the hatch tier.")
.addInfo(EnumChatFormatting.RED + "Limit to one energy hatch if using a Multi-Amp or Laser hatch.")
.beginStructureBlock(35, 33, 35, false)
.addCasingInfoMin("Background Radiation Absorbent Casing", 950, false)
.addCasingInfoExactly("Extreme Density Space-Bending Casing", 3667, false)
Expand Down Expand Up @@ -416,6 +417,11 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
spacetimeHatches.clear();

if (!checkPiece(STRUCTURE_PIECE_MAIN, 17, 27, 10)) return false;
// Allow only 1 energy hatch if laser/multiamp
if (!mExoticEnergyHatches.isEmpty()) {
if (!mEnergyHatches.isEmpty()) return false;
if (mExoticEnergyHatches.size() > 1) return false;
}
return mCasingAmount >= 950;
}

Expand Down Expand Up @@ -685,7 +691,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
}

public int getMaxParallelRecipes() {
int parallels = (8 * GTUtility.getTier(this.getMaxInputVoltage()));
int parallels = (8 * GTUtility.getTierExtended(this.getMaxInputEu()));
if (blackHoleStatus == 4) parallels *= 4;
else if (blackHoleStability < 60) {
parallels *= 2;
Expand Down

0 comments on commit d952452

Please sign in to comment.