From e5a6de86d47d12130afe179303d7de5b78c85bff Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Fri, 25 Jun 2021 20:54:11 +0800 Subject: general bugfix & tweaking pass for multis 1. stupid typo in EBF preventing it from working at all. 2. All multis now require exactly one maintenance hatch to form. 3. All multis now use the unified overclocking mechanism if possible. 4. All multis that emits pollution now require at least one muffler hatch to form. 5. Coil structure element slightly tweaked. Signed-off-by: Glease <4586901+Glease@users.noreply.github.com> --- .../gregtech/api/util/GT_StructureUtility.java | 30 ++++++++-------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'src/main/java/gregtech/api/util/GT_StructureUtility.java') diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java index 2670d9e684..5067c698ab 100644 --- a/src/main/java/gregtech/api/util/GT_StructureUtility.java +++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java @@ -7,6 +7,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.common.blocks.GT_Block_Casings5; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -19,8 +20,6 @@ import java.util.function.Function; import static com.gtnewhorizon.structurelib.StructureLibAPI.HINT_BLOCK_META_GENERIC_11; public class GT_StructureUtility { - public static final int HINT_COIL_DEFAULT_DOTS = HINT_BLOCK_META_GENERIC_11; - private GT_StructureUtility() { throw new AssertionError("Not instantiable"); } @@ -81,22 +80,14 @@ public class GT_StructureUtility { } /** - * Assume a default of LV coil. Assume all coils accepted. Assumes using {@link #HINT_COIL_DEFAULT_DOTS} as dots. - * @see #ofCoil(BiPredicate, Function, int, Block, int) + * Assume all coils accepted. + * @see #ofCoil(BiPredicate, Function) */ public static IStructureElement ofCoil(BiConsumer heatingCoilSetter, Function heatingCoilGetter) { return ofCoil((t, l) -> { heatingCoilSetter.accept(t, l); return true; - }, heatingCoilGetter, HINT_COIL_DEFAULT_DOTS, GregTech_API.sBlockCasings5, 0); - } - - /** - * Assumes using {@link #HINT_COIL_DEFAULT_DOTS} as dots - * @see #ofCoil(BiPredicate, Function, int, Block, int) - */ - public static IStructureElement ofCoil(BiPredicate heatingCoilSetter, Function heatingCoilGetter, Block defaultCoil, int defaultMeta) { - return ofCoil(heatingCoilSetter, heatingCoilGetter, HINT_COIL_DEFAULT_DOTS, defaultCoil, defaultMeta); + }, heatingCoilGetter); } /** @@ -106,11 +97,8 @@ public class GT_StructureUtility { * Might be called less times if structure test fails. * If the setter returns false then it assumes the coil is rejected. * @param heatingCoilGetter Get the current heating level. Null means no coil recorded yet. - * @param dots The hinting dots - * @param defaultCoil The block to place when auto constructing - * @param defaultMeta The block meta to place when auto constructing */ - public static IStructureElement ofCoil(BiPredicate heatingCoilSetter, Function heatingCoilGetter, int dots, Block defaultCoil, int defaultMeta) { + public static IStructureElement ofCoil(BiPredicate heatingCoilSetter, Function heatingCoilGetter) { if (heatingCoilSetter == null || heatingCoilGetter == null) { throw new IllegalArgumentException(); } @@ -131,13 +119,17 @@ public class GT_StructureUtility { @Override public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), dots); + StructureLibAPI.hintParticle(world, x, y, z, GregTech_API.sBlockCasings5, getMeta(trigger)); return true; } + private int getMeta(ItemStack trigger) { + return GT_Block_Casings5.getMetaFromCoilHeat(HeatingCoilLevel.getFromTier((byte) Math.min(HeatingCoilLevel.size(), Math.max(0, trigger.stackSize)))); + } + @Override public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - return world.setBlock(x, y, z, defaultCoil, defaultMeta, 3); + return world.setBlock(x, y, z, GregTech_API.sBlockCasings5, getMeta(trigger), 3); } }; } -- cgit