Skip to content

Commit

Permalink
Merge branch 'master' into fix-bhc-circuits
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Jan 21, 2025
2 parents d6beb6c + f1319fc commit 5280960
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/gregtech/api/GregTechAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ public class GregTechAPI {
sBlockMetal9, sBlockGem1, sBlockGem2, sBlockGem3, sBlockReinforced;
public static Block sBlockGranites, sBlockConcretes, sBlockStones;
public static Block sBlockCasings1, sBlockCasings2, sBlockCasings3, sBlockCasings4, sBlockCasings5, sBlockCasings6,
sBlockCasings8, sBlockCasings9, sBlockCasings10, sBlockCasings11, sSolenoidCoilCasings, sBlockCasingsNH;
sBlockCasings8, sBlockCasings9, sBlockCasings10, sBlockCasings11, sBlockCasings12, sSolenoidCoilCasings,
sBlockCasingsNH;
public static Block sBlockLongDistancePipes;
public static Block sDroneRender;
public static Block sBlockFrames;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/enums/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -1794,7 +1794,7 @@ public enum BlockIcons implements IIconContainer, Runnable {
* page 2: 0-15 solenoid coils
* page 8: 0-111 TecTech, 112-127 GT casing 6
* page 12: 0-127 GlodBlock
* page 16: 0-15 GT glass 1, 16-31 GT casing 9, 32-47 GT glass 2, 48-63 GT casing 10, 64-79 GT casing 11
* page 16: 0-15 GT glass 1, 16-31 GT casing 9, 32-47 GT glass 2, 48-63 GT casing 10, 64-79 GT casing 11, 80-95 GT casing 12
* page 42: 0-126 glee8e, 127 KekzTech LSC base
*/
// spotless:on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
Expand Down Expand Up @@ -67,6 +68,8 @@
import gregtech.common.covers.CoverDrain;
import gregtech.common.covers.CoverFluidRegulator;
import gregtech.common.covers.CoverInfo;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;

public class MTEFluid extends MetaPipeEntity {

Expand Down Expand Up @@ -931,6 +934,43 @@ public FluidStack drain(ForgeDirection side, FluidStack aFluid, boolean doDrain)
return null;
}

@Override
public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {

// Basic pipe stats
currenttip.add(
StatCollector.translateToLocal("GT5U.item.pipe.capacity") + ": "
+ EnumChatFormatting.BLUE
+ GTUtility.formatNumbers(mCapacity * 20L)
+ " L/s");

currenttip.add(
StatCollector.translateToLocal("GT5U.item.pipe.heat_resistance") + ": "
+ EnumChatFormatting.RED
+ GTUtility.formatNumbers(mHeatResistance)
+ "K");

// Gas handling info
if (mGasProof) {
currenttip.add(
StatCollector.translateToLocal("GT5U.item.pipe.gas_proof") + ": "
+ EnumChatFormatting.GREEN
+ StatCollector.translateToLocal("GT5U.item.pipe.gas_proof.yes"));
} else {
currenttip.add(
StatCollector.translateToLocal("GT5U.item.pipe.gas_proof") + ": "
+ EnumChatFormatting.RED
+ StatCollector.translateToLocal("GT5U.item.pipe.gas_proof.no"));
}

// Multi-pipe info
if (mPipeAmount > 1) {
currenttip.add(
StatCollector.translateToLocal("GT5U.item.pipe.amount") + ": " + EnumChatFormatting.AQUA + mPipeAmount);
}
}

private static EnumMap<Border, ForgeDirection> borderMap(ForgeDirection topSide, ForgeDirection bottomSide,
ForgeDirection leftSide, ForgeDirection rightSide) {
final EnumMap<Border, ForgeDirection> sideMap = new EnumMap<>(Border.class);
Expand Down
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
31 changes: 31 additions & 0 deletions src/main/java/gregtech/common/blocks/BlockCasings12.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package gregtech.common.blocks;

import net.minecraft.util.IIcon;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.enums.Textures;

/**
* The casings are split into separate files because they are registered as regular blocks, and a regular block can have
* 16 subtypes at most.
*/
public class BlockCasings12 extends BlockCasingsAbstract {

public BlockCasings12() {
super(ItemCasings12.class, "gt.blockcasings12", MaterialCasings.INSTANCE, 16);
}

@Override
public int getTextureIndex(int aMeta) {
return (16 << 7) | (aMeta + 80);
}

@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int ordinalSide, int aMeta) {
return switch (aMeta) {
default -> Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
};
}
}
14 changes: 14 additions & 0 deletions src/main/java/gregtech/common/blocks/ItemCasings12.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package gregtech.common.blocks;

import net.minecraft.block.Block;

/**
* The casings are split into separate files because they are registered as regular blocks, and a regular block can have
* 16 subtypes at most.
*/
public class ItemCasings12 extends ItemCasingsAbstract {

public ItemCasings12(Block block) {
super(block);
}
}
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 @@ -702,7 +708,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
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import gregtech.common.blocks.BlockCasings1;
import gregtech.common.blocks.BlockCasings10;
import gregtech.common.blocks.BlockCasings11;
import gregtech.common.blocks.BlockCasings12;
import gregtech.common.blocks.BlockCasings2;
import gregtech.common.blocks.BlockCasings3;
import gregtech.common.blocks.BlockCasings4;
Expand Down Expand Up @@ -545,6 +546,7 @@ public void run() {
GregTechAPI.sBlockCasings9 = new BlockCasings9();
GregTechAPI.sBlockCasings10 = new BlockCasings10();
GregTechAPI.sBlockCasings11 = new BlockCasings11();
GregTechAPI.sBlockCasings12 = new BlockCasings12();
GregTechAPI.sBlockCasingsNH = new BlockCasingsNH();
GregTechAPI.sBlockGranites = new BlockGranites();
GregTechAPI.sBlockLongDistancePipes = new BlockLongDistancePipe();
Expand Down
8 changes: 8 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,14 @@ GT5U.item.cable.loss=Loss/Meter/Ampere
GT5U.item.cable.eu_volt=EU-Volt
GT5U.item.tank.locked_to=Content locked to %s

GT5U.item.pipe.capacity=Capacity
GT5U.item.pipe.heat_resistance=Heat Resistance
GT5U.item.pipe.gas_proof=Gas Proof
GT5U.item.pipe.gas_proof.yes=Yes
GT5U.item.pipe.gas_proof.no=No
GT5U.item.pipe.amount=Pipe Amount
GT5U.item.pipe.empty=Empty

gt.behaviour.paintspray.infinite.gui.header=Select a Color
gt.behaviour.paintspray.infinite.gui.lock_error=§eSpray can is §clocked§e! §bSneak middle-click to unlock.
gt.behaviour.paintspray.infinite.gui.solvent=Solvent
Expand Down

0 comments on commit 5280960

Please sign in to comment.