diff options
author | Tec <daniel112092@gmail.com> | 2020-04-26 00:29:14 +0200 |
---|---|---|
committer | Tec <daniel112092@gmail.com> | 2020-04-26 00:29:14 +0200 |
commit | 5ab4d194f5e46ab71b07eac45b3980b80411864a (patch) | |
tree | 14af4492053a2397b241d27a40fbb233e9faca79 /src | |
parent | a66cc45857e9a414f7d2d8c4257871212007596b (diff) | |
download | GT5-Unofficial-5ab4d194f5e46ab71b07eac45b3980b80411864a.tar.gz GT5-Unofficial-5ab4d194f5e46ab71b07eac45b3980b80411864a.tar.bz2 GT5-Unofficial-5ab4d194f5e46ab71b07eac45b3980b80411864a.zip |
Add hint blocks and fallbacks
Diffstat (limited to 'src')
2 files changed, 52 insertions, 5 deletions
diff --git a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java index 69f5a6e43c..fe7a0d7510 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java +++ b/src/main/java/com/github/technus/tectech/mechanics/structure/StructureUtility.java @@ -13,14 +13,51 @@ import net.minecraft.world.World; import java.util.*; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; + public class StructureUtility { private static final String NICE_CHARS ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_=|[]{};:'<>,./?"; @SuppressWarnings("rawtypes") private static final Map<Vec3Impl,IStructureNavigate> STEP = new HashMap<>(); @SuppressWarnings("rawtypes") - private static final IStructureElement AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() == Material.air; + private static final IStructureElement AIR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() == Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,13); + return true; + } + }; + @SuppressWarnings("rawtypes") + private static final IStructureElement NOT_AIR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return world.getBlock(x, y, z).getMaterial() != Material.air; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,14); + return true; + } + }; @SuppressWarnings("rawtypes") - private static final IStructureElement NOT_AIR= (t, world, x, y, z) -> world.getBlock(x, y, z).getMaterial() != Material.air; + private static final IStructureElement ERROR= new IStructureElement() { + @Override + public boolean check(Object t, World world, int x, int y, int z) { + return false; + } + + @Override + public boolean spawnHint(Object o, World world, int x, int y, int z) { + TecTech.proxy.hint_particle(world,x,y,z,sHintCasingsTT,15); + return true; + } + }; private StructureUtility(){ @@ -36,6 +73,11 @@ public class StructureUtility { return NOT_AIR; } + @SuppressWarnings("unchecked") + public static <T> IStructureElement<T> error(){ + return ERROR; + } + /** * Does not allow Block duplicates (with different meta) */ @@ -277,6 +319,7 @@ public class StructureUtility { }; } + @SafeVarargs public static <T> IStructureFallback<T> ofElementChain(IStructureElement<T>... elementChain){ if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); @@ -289,6 +332,7 @@ public class StructureUtility { return () -> elementChain; } + @SafeVarargs public static <T> IStructureFallbackProvider<T> ofProviderChain(IStructureElementProvider<T>... elementChain){ if(elementChain==null || elementChain.length==0){ throw new IllegalArgumentException(); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java index 6d83b80d9a..62c2b981a1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java @@ -20,11 +20,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofBlock; -import static com.github.technus.tectech.mechanics.structure.StructureUtility.ofHatchAdder; +import static com.github.technus.tectech.mechanics.structure.StructureUtility.*; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sHintCasingsTT; import static gregtech.api.GregTech_API.sBlockCasings1; import static net.minecraft.util.StatCollector.translateToLocal; @@ -45,7 +45,10 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo {"111", "111", "111",}, }) .addElement('0', ofBlock(sBlockCasings1,15)) - .addElement('1', trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sBlockCasingsTT,0)) + .addElement('1', ofProviderChain( + trafo->ofHatchAdder(trafo::addEnergyIOToMachineList,textureOffset,sHintCasingsTT,0), + ofBlock(sBlockCasingsTT,0) + )) .build(); @Override |