aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util
diff options
context:
space:
mode:
authorGlease <4586901+Glease@users.noreply.github.com>2021-07-19 15:51:27 +0800
committerGlease <4586901+Glease@users.noreply.github.com>2021-07-30 14:41:35 +0800
commitbfe1836ddc069653d9af9d59008ec23f4dcb6c05 (patch)
treed392068bb01d345501f4851756d209813f872a4b /src/main/java/gregtech/api/util
parent1cdefed2daf27b0a36032067f9af97962bf353fb (diff)
downloadGT5-Unofficial-bfe1836ddc069653d9af9d59008ec23f4dcb6c05.tar.gz
GT5-Unofficial-bfe1836ddc069653d9af9d59008ec23f4dcb6c05.tar.bz2
GT5-Unofficial-bfe1836ddc069653d9af9d59008ec23f4dcb6c05.zip
Fixes related to coil hint blocks
Also updates StructureLib to fix invisible block hint and pulled the utility methods up. Signed-off-by: Glease <4586901+Glease@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/util')
-rw-r--r--src/main/java/gregtech/api/util/GT_StructureUtility.java36
1 files changed, 2 insertions, 34 deletions
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;
- }
- };
- }
}