diff options
Diffstat (limited to 'src/main')
31 files changed, 759 insertions, 693 deletions
diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java index ab6b723e09..eb9b97deee 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -24,7 +25,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -123,7 +123,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -139,7 +139,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java index 309d029b8e..0259aec7a7 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInsta import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_quantizer; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -24,7 +25,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.ForgeDirection; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.compatibility.thaumcraft.thing.metaTileEntity.multi.EssentiaCompat.essentiaContainerCompat; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -127,7 +127,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java new file mode 100644 index 0000000000..2dc56754f8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -0,0 +1,47 @@ +package com.github.technus.tectech.loader; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; +import com.github.technus.tectech.mechanics.constructable.Structure; +import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; + +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.*; +import static gregtech.api.GregTech_API.sBlockCasings1; + +public class ConstructableLoader implements Runnable { + + @Override + public void run() { + registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace .class, new IMultiblockInfoContainer() { + //region Structure + private final String[][] shape = new String[][]{ + {"000","\"\"\"","\"\"\""," . ",}, + {"0!0","\"A\"","\"A\""," ",}, + {"000","\"\"\"","\"\"\""," ",}, + }; + private final Block[] blockType = new Block[]{sBlockCasings1}; + private final byte[] blockMeta = new byte[]{11}; + private final String[] desc=new String[]{ + EnumChatFormatting.AQUA+"Hint Details:", + "1 - Classic Hatches or Heat Proof Casing", + "2 - Muffler Hatch", + "3 - Coil blocks" + }; + //endregion + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); + } + + @Override + public String[] getDescription(int stackSize) { + return desc; + } + }); + } +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java index fdfa2904fb..d7c3c86098 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -1,13 +1,14 @@ -package com.github.technus.tectech.mechanics.constructible; +package com.github.technus.tectech.mechanics.constructable; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.item.ItemStack; /** * Created by Tec on 24.03.2017. */ public interface IConstructable { - void construct(int stackSize, boolean hintsOnly); + void construct(ItemStack stackSize, boolean hintsOnly); @SideOnly(Side.CLIENT) String[] getStructureDescription(int stackSize); diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java new file mode 100644 index 0000000000..29769fafb8 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -0,0 +1,30 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; + +import java.util.HashMap; + +/** + * To implement IConstructable on not own TileEntities + */ +public interface IMultiblockInfoContainer { + HashMap<String, IMultiblockInfoContainer> MULTIBLOCK_MAP = new HashMap<>(); + + static void registerTileClass(Class<? extends TileEntity> clazz, IMultiblockInfoContainer info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + static void registerMetaClass(Class<? extends IMetaTileEntity> clazz, IMultiblockInfoContainer info){ + MULTIBLOCK_MAP.put(clazz.getCanonicalName(),info); + } + + void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide); + + @SideOnly(Side.CLIENT) + String[] getDescription(int stackSize); +} diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java new file mode 100644 index 0000000000..00ffb32525 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java @@ -0,0 +1,526 @@ +package com.github.technus.tectech.mechanics.constructable; + +import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.thing.casing.TT_Container_Casings; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; +import static gregtech.api.enums.GT_Values.E; + +public class Structure { + private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); + + private Structure(){} + + //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller + //This only checks for REGULAR BLOCKS! + public static boolean checker( + String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + IHatchAdder[] addingMethods, + short[] casingTextures, + Block[] blockTypeFallback,//use numbers 0-9 for casing types + byte[] blockMetaFallback,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity aBaseMetaTileEntity, + ExtendedFacing extendedFacing, + boolean forceCheck) { + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return false; + } + //TE Rotation + if(extendedFacing==null){ + extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); + } + + IGregTechTileEntity igt; + + int[] xyz =new int[3]; + int[] abc =new int[3]; + int pointer; + int baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.') { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos + switch (block) { + case '-'://must be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { + return false; + } + break; + case '+'://must not be air + if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { + return false; + } + break; + default://check for block (countable) + if ((pointer = block - '0') >= 0) { + //countable air -> net.minecraft.block.BlockAir + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); + } + return false; + } + } else //noinspection ConstantConditions + if ((pointer = block - ' ') >= 0) { + igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); + if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); + } + return false; + } + if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { + if (DEBUG_MODE) { + TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); + } + return false; + } + } + } + } + } else if (forceCheck) { + return false; + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + IGregTechTileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorld(),tileEntity.getXCoord(),tileEntity.getYCoord(),tileEntity.getZCoord(), + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + TileEntity tileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { + return builder(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, + tileEntity.getWorldObj(),tileEntity.xCoord,tileEntity.yCoord,tileEntity.zCoord, + extendedFacing, hintsOnly); + } + + public static boolean builder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks + Block[] blockType,//use numbers 0-9 for casing types + byte[] blockMeta,//use numbers 0-9 for casing types + int horizontalOffset, int verticalOffset, int depthOffset, + World world,int baseX,int baseZ,int baseY, ExtendedFacing extendedFacing, boolean hintsOnly) { + if (world==null || (!world.isRemote && hintsOnly)) { + return false; + } + + //TE Rotation + int[] xyz =new int[3]; + int[] abc =new int[3]; + int pointer; + + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + + //perform your duties + abc[2] = -depthOffset; + for (String[] _structure : structure) {//front to back + abc[1] = verticalOffset; + for (String __structure : _structure) {//top to bottom + abc[0] = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block < ' ') {//Control chars allow skipping + abc[1] -= block; + break; + } + if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. + { + abc[0] += block - '@'; + }//else if (block < '+')//used to mark THINGS + // a++; + else if (block == '.')// this TE + { + abc[0]++; + } else { + //get x y z from rotation + extendedFacing.getWorldOffset(abc,xyz); + xyz[0]+=baseX; + xyz[1]+=baseY; + xyz[2]+=baseZ; + + //that must be here since in some cases other axis (b,c) controls y + if (xyz[1] < 0 || xyz[1] >= 256) { + return false; + } + + //Check block + if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded + if (hintsOnly) { + switch (block) { + case '-'://must be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); + break; + case '+'://must not be air + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); + } + } else if ((pointer = block - ' ') >= 0) { + if (pointer >= 0 && pointer < 12) { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); + } + } else { + TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); + } + } + } else { + switch (block) { + case '-'://must be air + world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); + break; + case '+'://must not be air + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); + break; + default: //check for block + if ((pointer = block - '0') >= 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); + } else if (block - ' ' < 0) { + world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); + } //else { + //switch(pointer){ + // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: + // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; + // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); + //} + //} + } + } + } + abc[0]++;//block in horizontal layer + } + } + abc[1]--;//horizontal layer + } + abc[2]++;//depth + } + return true; + } + + + public static String[] writer(IGregTechTileEntity aBaseMetaTileEntity, + int horizontalOffset, int verticalOffset, int depthOffset, + int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { + //TE Rotation + byte facing = aBaseMetaTileEntity.getFrontFacing(); + World world = aBaseMetaTileEntity.getWorld(); + if (world.isRemote) { + return new String[]{"Not at Client m8"}; + } + + ItemStack[] array = new ItemStack[10]; + + int x, y, z, a, b, c; + int + baseX = aBaseMetaTileEntity.getXCoord(), + baseZ = aBaseMetaTileEntity.getZCoord(), + baseY = aBaseMetaTileEntity.getYCoord(); + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + //yPos - absolute height of checked block + + //perform your duties - #1 - count block types + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //that must be here since in some cases other axis (b,c) controls y + if (y < 0 || y >= 256) { + return new String[]{"Invalid position"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { + boolean err = true; + ItemStack is = new ItemStack(block, 1, meta); + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + array[i] = is; + err = false; + break; + } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { + err = false; + break; + } + } + if (err) { + return new String[]{"Too much different blocks"}; + } + } + + a++;//block in horizontal layer + } + b--;//horizontal layer + } + c++;//depth + } + + List<String> output = new ArrayList<>(); + + output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); + output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); + output.add(""); + + output.add("ID[]: Name[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getDisplayName()); + } + } + output.add(""); + output.add("ID[]: Block[] BlockMetaID[]"); + output.add(""); + for (int i = 0; i < array.length; i++) { + if (array[i] != null) { + output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); + } + } + output.add(""); + output.add("String[][]"); + //perform your duties - #2 - write strings + output.add("{"); + c = -depthOffset; + for (int cz = 0; cz < depthSize; cz++) {//front to back + b = verticalOffset; + StringBuilder addMe = new StringBuilder().append('{'); + for (int by = 0; by < verticalSize; by++) {//top to bottom + a = -horizontalOffset; + StringBuilder line = new StringBuilder(); + for (int az = 0; az < horizontalSize; az++) {//left to right + //get x y z from rotation + switch (facing) {//translation + case 4: + x = baseX + c; + z = baseZ + a; + y = baseY + b; + break; + case 3: + x = baseX + a; + z = baseZ - c; + y = baseY + b; + break; + case 5: + x = baseX - c; + z = baseZ - a; + y = baseY + b; + break; + case 2: + x = baseX - a; + z = baseZ + c; + y = baseY + b; + break; + //Things get odd if the block faces up or down... + case 1: + x = baseX + a; + z = baseZ + b; + y = baseY - c; + break;//similar to 3 + case 0: + x = baseX - a; + z = baseZ - b; + y = baseY + c; + break;//similar to 2 + default: + return new String[]{"Invalid rotation"}; + } + + //Check block + Block block = world.getBlock(x, y, z); + int meta = world.getBlockMetadata(x, y, z); + + if (a == 0 && b == 0 && c == 0) { + line.append('.'); + } else if (block.getMaterial() == Material.air) { + line.append('-'); + } else if (block.hasTileEntity(meta)) { + line.append('*'); + } else { + ItemStack stack = new ItemStack(block, 1, meta); + String str = "?";//OH YEAH NPEs + for (int i = 0; i < array.length; i++) { + if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { + str = Integer.toString(i); + break; + } + } + line.append(str); + } + a++;//block in horizontal layer + } + if (ignoreAir) { + StringBuilder builder = new StringBuilder(); + char temp = '@'; + for (char ch : line.toString().toCharArray()) { + if (ch == '-') { + temp += 1; + if (temp == '~') { + builder.append('~'); + temp = '@'; + } + } else { + if (temp > '@') { + builder.append(temp); + temp = '@'; + } + builder.append(ch); + } + } + while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { + builder.deleteCharAt(builder.length() - 1); + } + if (builder.length() == 0) { + builder.append("E,"); + } else { + builder.insert(0, '"'); + builder.append('"').append(','); + } + addMe.append(builder); + } else { + if (line.length() == 0) { + line.append("E,"); + } else { + line.insert(0, '"'); + line.append('"').append(','); + } + addMe.append(line); + } + b--;//horizontal layer + } + //region less verbose + addMe.append('}').append(','); + String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); + Matcher matcher = matchE_.matcher(builtStr); + while (matcher.find()) { + byte lenEE = (byte) (matcher.group(1).length() >> 1); + builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); + //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); + } + //endregion + output.add(builtStr); + c++;//depth + } + output.add("}"); + return output.toArray(new String[0]); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 4af6b53658..7b7d1983fa 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -1,15 +1,15 @@ package com.github.technus.tectech.thing.item; +import com.github.technus.tectech.mechanics.alignment.IAlignment; +import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; +import com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; -import net.minecraft.block.Block; +import gregtech.api.interfaces.tileentity.IMachineBlockUpdateable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; @@ -18,14 +18,13 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.World; import net.minecraftforge.common.util.FakePlayer; +import net.minecraftforge.common.util.ForgeDirection; -import java.util.HashMap; import java.util.List; import static com.github.technus.tectech.Reference.MODID; -import static com.github.technus.tectech.util.Util.StructureBuilder; import static com.github.technus.tectech.loader.gui.CreativeTabTecTech.creativeTabTecTech; -import static gregtech.api.GregTech_API.sBlockCasings1; +import static com.github.technus.tectech.mechanics.constructable.IMultiblockInfoContainer.MULTIBLOCK_MAP; import static net.minecraft.util.StatCollector.translateToLocal; /** @@ -34,8 +33,6 @@ import static net.minecraft.util.StatCollector.translateToLocal; public final class ConstructableTriggerItem extends Item { public static ConstructableTriggerItem INSTANCE; - private static HashMap<String, IMultiblockInfoContainer> multiblockMap= new HashMap<>(); - private ConstructableTriggerItem() { setUnlocalizedName("em.constructable"); setTextureName(MODID + ":itemConstructable"); @@ -54,14 +51,28 @@ public final class ConstructableTriggerItem extends Item { if (tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(metaTE.getClass().getCanonicalName())) { - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, ((IGregTechTileEntity) tTileEntity).getFrontFacing()); + ((IConstructable) metaTE).construct(aStack, false); + } else if (MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())) { + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } } } else if (tTileEntity instanceof IConstructable) { - ((IConstructable) tTileEntity).construct(aStack.stackSize, false); - } else if (multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())) { - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize, false, tTileEntity, aSide); + ((IConstructable) tTileEntity).construct(aStack, false); + } else if (MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())) { + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, false, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } } } return true; @@ -70,21 +81,35 @@ public final class ConstructableTriggerItem extends Item { if(tTileEntity instanceof IGregTechTileEntity) { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE instanceof IConstructable) { - ((IConstructable) metaTE).construct(aStack.stackSize, true); + ((IConstructable) metaTE).construct(aStack, true); TecTech.proxy.printInchat(((IConstructable) metaTE).getStructureDescription(aStack.stackSize)); return false; - } else if(multiblockMap.containsKey(metaTE.getClass().getCanonicalName())){ - multiblockMap.get(metaTE.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity,((IGregTechTileEntity) tTileEntity).getFrontFacing()); - TecTech.proxy.printInchat(multiblockMap.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + } else if(MULTIBLOCK_MAP.containsKey(metaTE.getClass().getCanonicalName())){ + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()); + if(metaTE instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, ( + (IAlignment) metaTE).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(((IGregTechTileEntity) tTileEntity).getFrontFacing()))); + } + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(metaTE.getClass().getCanonicalName()).getDescription(aStack.stackSize)); return false; } } else if(tTileEntity instanceof IConstructable){ - ((IConstructable) tTileEntity).construct(aStack.stackSize,true); + ((IConstructable) tTileEntity).construct(aStack,true); TecTech.proxy.printInchat(((IConstructable) tTileEntity).getStructureDescription(aStack.stackSize)); return false; - } else if(multiblockMap.containsKey(tTileEntity.getClass().getCanonicalName())){ - multiblockMap.get(tTileEntity.getClass().getCanonicalName()).construct(aStack.stackSize,true,tTileEntity, aSide); - TecTech.proxy.printInchat(multiblockMap.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); + } else if(MULTIBLOCK_MAP.containsKey(tTileEntity.getClass().getCanonicalName())){ + IMultiblockInfoContainer iMultiblockInfoContainer = MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()); + if(tTileEntity instanceof IAlignment){ + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ((IAlignment) tTileEntity).getExtendedFacing()); + }else { + iMultiblockInfoContainer.construct(aStack, true, tTileEntity, + ExtendedFacing.of(ForgeDirection.getOrientation(aSide))); + } + TecTech.proxy.printInchat(MULTIBLOCK_MAP.get(tTileEntity.getClass().getCanonicalName()).getDescription(aStack.stackSize)); return false; } //} else { @@ -122,47 +147,5 @@ public final class ConstructableTriggerItem extends Item { public static void run() { INSTANCE = new ConstructableTriggerItem(); GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); - - registerMetaClass(GT_MetaTileEntity_ElectricBlastFurnace.class, new IMultiblockInfoContainer() { - //region Structure - private final String[][] shape = new String[][]{ - {"000","\"\"\"","\"\"\""," . ",}, - {"0!0","\"A\"","\"A\""," ",}, - {"000","\"\"\"","\"\"\""," ",}, - }; - private final Block[] blockType = new Block[]{sBlockCasings1}; - private final byte[] blockMeta = new byte[]{11}; - private final String[] desc=new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or Heat Proof Casing", - "2 - Muffler Hatch", - "3 - Coil blocks" - }; - //endregion - - @Override - public void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide) { - StructureBuilder(shape, blockType, blockMeta, 1, 3, 0, tileEntity, aSide, hintsOnly); - } - - @Override - public String[] getDescription(int stackSize) { - return desc; - } - }); - } - - public interface IMultiblockInfoContainer { - void construct(int stackSize, boolean hintsOnly, TileEntity tileEntity, int aSide); - @SideOnly(Side.CLIENT) - String[] getDescription(int stackSize); - } - - public static void registerTileClass(Class<? extends TileEntity> clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); - } - - public static void registerMetaClass(Class<? extends IMetaTileEntity> clazz, IMultiblockInfoContainer info){ - multiblockMap.put(clazz.getCanonicalName(),info); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java index d52a3c23f7..4333d4c8c9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -103,8 +103,8 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java index 74ebae9f57..c5aaa1d66f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -297,11 +297,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E } @Override - public void construct(int stackSize, boolean hintsOnly) { - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + if ((stackSize.stackSize & 1) == 1) { + Structure.builder(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + Structure.builder(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java index d37fcfdc4b..fe676910ee 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.dComplexAspectDefinition; @@ -13,7 +14,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.definitions.complex. import com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.eQuarkDefinition; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -33,7 +34,6 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -665,7 +665,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; @@ -681,10 +681,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB iGregTechTileEntity.getWorld().setBlock(iGregTechTileEntity.getXCoord() + xDir, iGregTechTileEntity.getYCoord() + yDir, iGregTechTileEntity.getZCoord() + zDir, TT_Container_Casings.sHintCasingsTT, 12, 2); } } - if ((stackSize & 1) == 1) { - StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + if ((stackSize.stackSize & 1) == 1) { + Structure.builder(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); + Structure.builder(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, getExtendedFacing(), hintsOnly); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java index 1afbdf66e0..433b8b4950 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java @@ -1,11 +1,12 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Rack; @@ -29,7 +30,6 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -335,18 +335,18 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { IGregTechTileEntity igt = getBaseMetaTileEntity(); - StructureBuilderExtreme(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); + Structure.builder(front, blockType, blockMeta, 1, 2, 0, igt, getExtendedFacing(), hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, -1, igt, getExtendedFacing(), hintsOnly); byte offset = -2; - for (int rackSlices = Math.min(stackSize, 12); rackSlices > 0; rackSlices--) { - StructureBuilderExtreme(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + for (int rackSlices = Math.min(stackSize.stackSize, 12); rackSlices > 0; rackSlices--) { + Structure.builder(slice, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); } - StructureBuilderExtreme(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); - StructureBuilderExtreme(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); + Structure.builder(cap, blockType, blockMeta, 1, 2, offset--, igt, getExtendedFacing(), hintsOnly); + Structure.builder(terminator, blockType, blockMeta, 1, 2, offset, igt, getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java index 3083f36721..7a71f36d3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -105,8 +105,8 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java index 57ab6d770d..647bbf4a3b 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.InventoryDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputDataItems; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputDataItems; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; @@ -28,7 +29,6 @@ import net.minecraft.util.ResourceLocation; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -170,8 +170,8 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java index ffea7781ee..be28a3d0c8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -27,7 +28,6 @@ import net.minecraft.util.EnumChatFormatting; import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -243,8 +243,8 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index cb13abf358..fed03d1845 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElementalInstanceStack; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.iHasElem import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictDequantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.iExchangeInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; @@ -25,7 +26,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.STABLE_RAW_LIFE_TIME; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refMass; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; @@ -148,8 +148,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java index 23a36f0edb..aed3025d4f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java @@ -1,10 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import cofh.api.energy.IEnergyContainerItem; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -22,7 +23,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; @@ -182,8 +182,8 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java index 448f0a5563..8a76ee6ff1 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java @@ -1,7 +1,8 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputElemental; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputElemental; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -13,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -169,8 +169,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java index 4696164979..6315a2f295 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.TecTech; @@ -11,7 +12,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.transformations import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.aOredictQuantizationInfo; import com.github.technus.tectech.mechanics.elementalMatter.core.transformations.bTransformationInfo; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import cpw.mods.fml.relauncher.Side; @@ -29,7 +30,6 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.util.Util.isInputEqual; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.core.templates.iElementalDefinition.DEFAULT_ENERGY_LEVEL; @@ -197,8 +197,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java index e9bb65c19f..2a739cb6c7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.recipe.TT_recipe; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Holder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -37,7 +38,6 @@ import java.util.LinkedHashMap; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.recipe.TT_recipe.E_RECIPE_ID; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -552,8 +552,8 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java index be869b2ba9..48479b9d71 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; @@ -11,7 +12,7 @@ import com.github.technus.tectech.thing.CustomItemList; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.enums.ItemList; @@ -34,7 +35,6 @@ import org.apache.commons.lang3.reflect.FieldUtils; import static com.github.technus.tectech.util.CommonValues.V; import static com.github.technus.tectech.util.CommonValues.VN; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.util.Util.areBitsSet; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.mechanics.elementalMatter.definitions.primitive.cPrimitiveDefinition.nbtE__; @@ -513,8 +513,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java index 9c88c4ecf3..ece01f7489 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -11,7 +12,6 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -69,8 +69,8 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java index 47949ea36e..39f9441cb7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java @@ -1,9 +1,10 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; import com.github.technus.tectech.mechanics.dataTransport.QuantumDataPacket; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_InputData; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_OutputData; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; @@ -21,7 +22,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; import static com.github.technus.tectech.util.CommonValues.V; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -216,8 +216,8 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override 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 81fd5eb6ad..c2e759e96c 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 @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -20,7 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -149,8 +149,8 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java index 1f9d88e4fd..2b2ebdd1a4 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlassBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; @@ -17,7 +18,6 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; 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; @@ -104,8 +104,8 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java index 497efd6f71..9c40d6ebc9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java @@ -1,8 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.Reference; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedExtendedFacingTexture; import com.github.technus.tectech.util.Vec3Impl; @@ -24,7 +25,6 @@ import net.minecraft.util.EnumChatFormatting; import java.util.ArrayList; import java.util.HashSet; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.loader.MainLoader.microwaving; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -245,8 +245,8 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java index bf18a545ef..678f211744 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java @@ -1,7 +1,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.util.CommonValues; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_Container_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_GUIContainer_MultiMachineEM; import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; @@ -121,7 +121,7 @@ public class GT_MetaTileEntity_TM_proccessingStack extends GT_MetaTileEntity_Mul } @Override - public void construct(int stackSize, boolean hintsOnly) { + public void construct(ItemStack stackSize, boolean hintsOnly) { //StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java index 85ccc5d881..327b54e561 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -7,7 +8,7 @@ import com.github.technus.tectech.mechanics.data.RendererMessage; import com.github.technus.tectech.mechanics.data.ThaumSpark; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil; import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_Capacitor; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; @@ -821,8 +822,8 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMetas[(stackSize.stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java index 50e2aa575b..2f23aae431 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.mechanics.alignment.*; import com.github.technus.tectech.mechanics.alignment.enumerable.ExtendedFacing; import com.github.technus.tectech.mechanics.alignment.enumerable.Flip; import com.github.technus.tectech.mechanics.alignment.enumerable.Rotation; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.util.Vec3Impl; import com.github.technus.tectech.loader.NetworkDispatcher; @@ -41,7 +42,6 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import static com.github.technus.tectech.util.CommonValues.*; -import static com.github.technus.tectech.util.Util.StructureCheckerExtreme; import static com.github.technus.tectech.util.Util.getTier; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; @@ -200,7 +200,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerExtreme(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, + return Structure.checker(structure, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), getExtendedFacing(), !mMachine); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java index dce8f56ce9..f6f3ec9a63 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java @@ -1,12 +1,13 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.em_machine; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; import com.github.technus.tectech.mechanics.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumStuffBlock; -import com.github.technus.tectech.mechanics.constructible.IConstructable; +import com.github.technus.tectech.mechanics.constructable.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -21,7 +22,6 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.HashMap; import java.util.function.Supplier; -import static com.github.technus.tectech.util.Util.StructureBuilderExtreme; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; @@ -349,8 +349,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); + public void construct(ItemStack stackSize, boolean hintsOnly) { + Structure.builder(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), getExtendedFacing(), hintsOnly); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java index f40752bcf5..194d357b1c 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java @@ -1,5 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.single; +import com.github.technus.tectech.mechanics.constructable.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.util.Util; @@ -20,7 +21,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; -import static com.github.technus.tectech.util.Util.StructureWriter; import static com.github.technus.tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT; import static net.minecraft.util.StatCollector.translateToLocal; @@ -107,7 +107,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); + result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); for (String s : result) { TecTech.LOGGER.info(s); } @@ -117,7 +117,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); + result = Structure.writer(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); for (String s : result) { TecTech.LOGGER.info(s); } diff --git a/src/main/java/com/github/technus/tectech/util/Util.java b/src/main/java/com/github/technus/tectech/util/Util.java index 7e6e177e77..b81506d27c 100644 --- a/src/main/java/com/github/technus/tectech/util/Util.java +++ b/src/main/java/com/github/technus/tectech/util/Util.java @@ -167,528 +167,6 @@ public final class Util { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } - //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller - //This only checks for REGULAR BLOCKS! - public static boolean StructureCheckerExtreme( - String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR-1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - IHatchAdder[] addingMethods, - short[] casingTextures, - Block[] blockTypeFallback,//use numbers 0-9 for casing types - byte[] blockMetaFallback,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, - ExtendedFacing extendedFacing, - boolean forceCheck) { - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return false; - } - //TE Rotation - if(extendedFacing==null){ - extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(aBaseMetaTileEntity.getFrontFacing())); - } - - IGregTechTileEntity igt; - - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - int baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } else if (block > '@') {//characters allow to skip check A-1 skip, B-2 skips etc. - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.') { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded at this pos - switch (block) { - case '-'://must be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() != Material.air) { - return false; - } - break; - case '+'://must not be air - if (world.getBlock(xyz[0], xyz[1], xyz[2]).getMaterial() == Material.air) { - return false; - } - break; - default://check for block (countable) - if ((pointer = block - '0') >= 0) { - //countable air -> net.minecraft.block.BlockAir - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + blockType[pointer].getUnlocalizedName()); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMeta[pointer]); - } - return false; - } - } else //noinspection ConstantConditions - if ((pointer = block - ' ') >= 0) { - igt = aBaseMetaTileEntity.getIGregTechTileEntity(xyz[0], xyz[1], xyz[2]); - if (igt == null || !addingMethods[pointer].apply(igt, casingTextures[pointer])) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockTypeFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-struct-block-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlock(xyz[0], xyz[1], xyz[2]).getUnlocalizedName() + ' ' + (blockTypeFallback[pointer] == null ? "null" : blockTypeFallback[pointer].getUnlocalizedName())); - } - return false; - } - if (world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMetaFallback[pointer]) { - if (DEBUG_MODE) { - TecTech.LOGGER.info("Fallback-Struct-meta-id-error " + xyz[0] + ' ' + xyz[1] + ' ' + xyz[2] + " / " + abc[0] + ' ' + abc[1] + ' ' + abc[2] + " / " + world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) + ' ' + blockMetaFallback[pointer]); - } - return false; - } - } - } - } - } else if (forceCheck) { - return false; - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), null, - facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - IGregTechTileEntity aBaseMetaTileEntity, ExtendedFacing extendedFacing, boolean hintsOnly) { - byte facing = aBaseMetaTileEntity.getFrontFacing(); - return StructureBuilderExtreme(structure, blockType, blockMeta, - horizontalOffset, verticalOffset, depthOffset, - aBaseMetaTileEntity.getWorld().getTileEntity(aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord()), extendedFacing, - facing, hintsOnly); - } - - public static boolean StructureBuilder(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, int facing, boolean hintsOnly) { - return StructureBuilderExtreme(structure, blockType, blockMeta, horizontalOffset, verticalOffset, depthOffset, tileEntity, null, facing, hintsOnly); - } - - public static boolean StructureBuilderExtreme(String[][] structure,//0-9 casing, +- air no air, A... ignore 'A'-CHAR+1 blocks - Block[] blockType,//use numbers 0-9 for casing types - byte[] blockMeta,//use numbers 0-9 for casing types - int horizontalOffset, int verticalOffset, int depthOffset, - TileEntity tileEntity, ExtendedFacing extendedFacing, int simpleFacing, boolean hintsOnly) { - if (!tileEntity.hasWorldObj()) { - return false; - } - World world = tileEntity.getWorldObj(); - if (!world.isRemote && hintsOnly) { - return false; - } - - //TE Rotation - int[] xyz =new int[3]; - int[] abc =new int[3]; - int pointer; - int - baseX = tileEntity.xCoord, - baseZ = tileEntity.zCoord, - baseY = tileEntity.yCoord; - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - if (extendedFacing == null) { - extendedFacing=ExtendedFacing.of(ForgeDirection.getOrientation(simpleFacing)); - } - - //perform your duties - abc[2] = -depthOffset; - for (String[] _structure : structure) {//front to back - abc[1] = verticalOffset; - for (String __structure : _structure) {//top to bottom - abc[0] = -horizontalOffset; - for (char block : __structure.toCharArray()) {//left to right - if (block < ' ') {//Control chars allow skipping - abc[1] -= block; - break; - } - if (block > '@')//characters allow to skip check a-1 skip, b-2 skips etc. - { - abc[0] += block - '@'; - }//else if (block < '+')//used to mark THINGS - // a++; - else if (block == '.')// this TE - { - abc[0]++; - } else { - //get x y z from rotation - extendedFacing.getWorldOffset(abc,xyz); - xyz[0]+=baseX; - xyz[1]+=baseY; - xyz[2]+=baseZ; - - //that must be here since in some cases other axis (b,c) controls y - if (xyz[1] < 0 || xyz[1] >= 256) { - return false; - } - - //Check block - if (world.blockExists(xyz[0], xyz[1], xyz[2])) {//this actually checks if the chunk is loaded - if (hintsOnly) { - switch (block) { - case '-'://must be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 13); - break; - case '+'://must not be air - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 14); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - if (world.getBlock(xyz[0], xyz[1], xyz[2]) != blockType[pointer] || world.getBlockMetadata(xyz[0], xyz[1], xyz[2]) != blockMeta[pointer]) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer]); - } - } else if ((pointer = block - ' ') >= 0) { - if (pointer >= 0 && pointer < 12) { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, pointer); - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 12); - } - } else { - TecTech.proxy.hint_particle(world, xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15); - } - } - } else { - switch (block) { - case '-'://must be air - world.setBlock(xyz[0], xyz[1], xyz[2], Blocks.air, 0, 2); - break; - case '+'://must not be air - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sBlockCasingsTT, 14, 2); - break; - default: //check for block - if ((pointer = block - '0') >= 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], blockType[pointer], blockMeta[pointer], 2); - } else if (block - ' ' < 0) { - world.setBlock(xyz[0], xyz[1], xyz[2], TT_Container_Casings.sHintCasingsTT, 15, 2); - } //else { - //switch(pointer){ - // case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: - // world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, pointer, 2); break; - // default:world.setBlock(x, y, z, TT_Container_Casings.sHintCasingsTT, 12, 2); - //} - //} - } - } - } - abc[0]++;//block in horizontal layer - } - } - abc[1]--;//horizontal layer - } - abc[2]++;//depth - } - return true; - } - - - public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize, boolean ignoreAir) { - //TE Rotation - byte facing = aBaseMetaTileEntity.getFrontFacing(); - World world = aBaseMetaTileEntity.getWorld(); - if (world.isRemote) { - return new String[]{"Not at Client m8"}; - } - - ItemStack[] array = new ItemStack[10]; - - int x, y, z, a, b, c; - int - baseX = aBaseMetaTileEntity.getXCoord(), - baseZ = aBaseMetaTileEntity.getZCoord(), - baseY = aBaseMetaTileEntity.getYCoord(); - //a,b,c - relative to block face! - //x,y,z - relative to block position on map! - //yPos - absolute height of checked block - - //perform your duties - #1 - count block types - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //that must be here since in some cases other axis (b,c) controls y - if (y < 0 || y >= 256) { - return new String[]{"Invalid position"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { - boolean err = true; - ItemStack is = new ItemStack(block, 1, meta); - for (int i = 0; i < array.length; i++) { - if (array[i] == null) { - array[i] = is; - err = false; - break; - } else if (is.getItem() == array[i].getItem() && is.getItemDamage() == array[i].getItemDamage()) { - err = false; - break; - } - } - if (err) { - return new String[]{"Too much different blocks"}; - } - } - - a++;//block in horizontal layer - } - b--;//horizontal layer - } - c++;//depth - } - - List<String> output = new ArrayList<>(); - - output.add("Offsets: " + horizontalOffset + ' ' + verticalOffset + ' ' + depthOffset); - output.add("Sizes: " + horizontalSize + ' ' + verticalSize + ' ' + depthSize); - output.add(""); - - output.add("ID[]: Name[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getDisplayName()); - } - } - output.add(""); - output.add("ID[]: Block[] BlockMetaID[]"); - output.add(""); - for (int i = 0; i < array.length; i++) { - if (array[i] != null) { - output.add(i + ": " + array[i].getItem().getUnlocalizedName() + ' ' + array[i].getItemDamage()); - } - } - output.add(""); - output.add("String[][]"); - //perform your duties - #2 - write strings - output.add("{"); - c = -depthOffset; - for (int cz = 0; cz < depthSize; cz++) {//front to back - b = verticalOffset; - StringBuilder addMe = new StringBuilder().append('{'); - for (int by = 0; by < verticalSize; by++) {//top to bottom - a = -horizontalOffset; - StringBuilder line = new StringBuilder(); - for (int az = 0; az < horizontalSize; az++) {//left to right - //get x y z from rotation - switch (facing) {//translation - case 4: - x = baseX + c; - z = baseZ + a; - y = baseY + b; - break; - case 3: - x = baseX + a; - z = baseZ - c; - y = baseY + b; - break; - case 5: - x = baseX - c; - z = baseZ - a; - y = baseY + b; - break; - case 2: - x = baseX - a; - z = baseZ + c; - y = baseY + b; - break; - //Things get odd if the block faces up or down... - case 1: - x = baseX + a; - z = baseZ + b; - y = baseY - c; - break;//similar to 3 - case 0: - x = baseX - a; - z = baseZ - b; - y = baseY + c; - break;//similar to 2 - default: - return new String[]{"Invalid rotation"}; - } - - //Check block - Block block = world.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - - if (a == 0 && b == 0 && c == 0) { - line.append('.'); - } else if (block.getMaterial() == Material.air) { - line.append('-'); - } else if (block.hasTileEntity(meta)) { - line.append('*'); - } else { - ItemStack stack = new ItemStack(block, 1, meta); - String str = "?";//OH YEAH NPEs - for (int i = 0; i < array.length; i++) { - if (array[i] != null && stack.getItem() == array[i].getItem() && stack.getItemDamage() == array[i].getItemDamage()) { - str = Integer.toString(i); - break; - } - } - line.append(str); - } - a++;//block in horizontal layer - } - if (ignoreAir) { - StringBuilder builder = new StringBuilder(); - char temp = '@'; - for (char ch : line.toString().toCharArray()) { - if (ch == '-') { - temp += 1; - if (temp == '~') { - builder.append('~'); - temp = '@'; - } - } else { - if (temp > '@') { - builder.append(temp); - temp = '@'; - } - builder.append(ch); - } - } - while (builder.length() > 0 && builder.charAt(builder.length() - 1) == '~') { - builder.deleteCharAt(builder.length() - 1); - } - if (builder.length() == 0) { - builder.append("E,"); - } else { - builder.insert(0, '"'); - builder.append('"').append(','); - } - addMe.append(builder); - } else { - if (line.length() == 0) { - line.append("E,"); - } else { - line.insert(0, '"'); - line.append('"').append(','); - } - addMe.append(line); - } - b--;//horizontal layer - } - //region less verbose - addMe.append('}').append(','); - String builtStr = addMe.toString().replaceAll("(E,)+(?=})", E/*Remove Empty strings at end*/); - Matcher matcher = matchE_.matcher(builtStr); - while (matcher.find()) { - byte lenEE = (byte) (matcher.group(1).length() >> 1); - builtStr = builtStr.replaceFirst("E,(E,)+", "\"\\\\u00" + String.format("%02X", lenEE - 1) + "\","); - //builtStr=builtStr.replaceFirst("E,(E,)+\"","\"\\\\u00"+String.format("%02X", lenEE)); - } - //endregion - output.add(builtStr); - c++;//depth - } - output.add("}"); - return output.toArray(new String[0]); - } - - private static final Pattern matchE_ = Pattern.compile("(E,(E,)+)"); - public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { if (!GregTech_API.sPostloadFinished) { return false; |