diff options
5 files changed, 19 insertions, 38 deletions
diff --git a/build.properties b/build.properties index c9a1e92d05..16566feedf 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 gt.version=5.09.37.02 -structurelib.version=1.0.4 +structurelib.version=1.0.5 ae2.version=rv3-beta-22 applecore.version=1.7.10-1.2.1+107.59407 buildcraft.version=7.1.11 diff --git a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java index c2e3ff075a..06ceedff53 100644 --- a/src/main/java/gregtech/api/enums/HeatingCoilLevel.java +++ b/src/main/java/gregtech/api/enums/HeatingCoilLevel.java @@ -63,7 +63,7 @@ public enum HeatingCoilLevel { } public static HeatingCoilLevel getFromTier(byte tier){ - if (tier < 0 || tier > VALUES.length -1) + if (tier < 0 || tier > getMaxTier()) return HeatingCoilLevel.None; return VALUES[tier+2]; @@ -72,4 +72,8 @@ public enum HeatingCoilLevel { public static int size() { return VALUES.length; } + + public static int getMaxTier() { + return VALUES.length - 1 - 2; + } } diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 6eb06d8fae..1adcb41259 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -11,6 +11,8 @@ import appeng.tile.events.TileEventType; import com.gtnewhorizon.structurelib.alignment.IAlignment; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructableProvider; import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing; import cpw.mods.fml.common.Optional; import gregtech.GT_Mod; @@ -54,6 +56,7 @@ import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; +import javax.annotation.Nullable; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; @@ -73,7 +76,7 @@ import static gregtech.api.objects.XSTR.XSTR_INSTANCE; @Optional.InterfaceList(value = { @Optional.Interface(iface = "appeng.api.networking.security.IActionHost", modid = "appliedenergistics2", striprefs = true), @Optional.Interface(iface = "appeng.me.helpers.IGridProxyable", modid = "appliedenergistics2", striprefs = true)}) -public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider { +public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileEntity, IActionHost, IGridProxyable, IAlignmentProvider, IConstructableProvider { private final GT_CoverBehavior[] mCoverBehaviors = new GT_CoverBehavior[]{GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior, GregTech_API.sNoBehavior}; protected MetaTileEntity mMetaTileEntity; protected long mStoredEnergy = 0, mStoredSteam = 0; @@ -2374,6 +2377,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE return getMetaTileEntity() instanceof IAlignmentProvider ? ((IAlignmentProvider) getMetaTileEntity()).getAlignment() : new BasicAlignment(); } + @Nullable + @Override + public IConstructable getConstructable() { + return getMetaTileEntity() instanceof IConstructable ? (IConstructable) getMetaTileEntity() : null; + } + private class BasicAlignment implements IAlignment { @Override diff --git a/src/main/java/gregtech/api/util/GT_StructureUtility.java b/src/main/java/gregtech/api/util/GT_StructureUtility.java index 7e39a0d838..dc916f02e3 100644 --- a/src/main/java/gregtech/api/util/GT_StructureUtility.java +++ b/src/main/java/gregtech/api/util/GT_StructureUtility.java @@ -124,7 +124,8 @@ public class GT_StructureUtility { } private int getMeta(ItemStack trigger) { - return GT_Block_Casings5.getMetaFromCoilHeat(HeatingCoilLevel.getFromTier((byte) Math.min(HeatingCoilLevel.size(), Math.max(0, trigger.stackSize)))); + // -4 to skip unimplemented tiers + return GT_Block_Casings5.getMetaFromCoilHeat(HeatingCoilLevel.getFromTier((byte) Math.min(HeatingCoilLevel.getMaxTier() - 4, Math.max(0, trigger.stackSize)))); } @Override @@ -133,37 +134,4 @@ public class GT_StructureUtility { } }; } - - public static <T> IStructureElement<T> ofBlockUnlocalizedName(String modid, String unlocalizedName, int meta) { - if (StringUtils.isBlank(unlocalizedName)) throw new IllegalArgumentException(); - if (meta < 0) throw new IllegalArgumentException(); - if (meta > 15) throw new IllegalArgumentException(); - if (StringUtils.isBlank(modid)) throw new IllegalArgumentException(); - return new IStructureElement<T>() { - private Block block; - - private Block getBlock() { - if (block == null) - block = GameRegistry.findBlock(modid, unlocalizedName); - return block; - } - - @Override - public boolean check(T t, World world, int x, int y, int z) { - return world.getBlock(x, y, z) != getBlock() && world.getBlockMetadata(x, y, z) == meta; - } - - @Override - public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, getBlock(), meta); - return true; - } - - @Override - public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { - world.setBlock(x, y, z, getBlock(), meta, 2); - return true; - } - }; - } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index 3db096eca3..7312e0d992 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -23,6 +23,7 @@ import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockUnlocalizedName; import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; @@ -30,7 +31,6 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_GLOW; -import static gregtech.api.util.GT_StructureUtility.ofBlockUnlocalizedName; import static gregtech.api.util.GT_StructureUtility.ofCoil; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; |