aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorTec <daniel112092@gmail.com>2020-04-20 17:19:19 +0200
committerTec <daniel112092@gmail.com>2020-04-20 17:19:19 +0200
commit9360d6afe97e029001f411d819f6d80dafdc95a3 (patch)
tree35aa4cf1c6a367f8cdcd72c8183db00436700d9a /src/main/java/com
parent1c8a7217e61057acb29279a987eff4cafb1a5d78 (diff)
downloadGT5-Unofficial-9360d6afe97e029001f411d819f6d80dafdc95a3.tar.gz
GT5-Unofficial-9360d6afe97e029001f411d819f6d80dafdc95a3.tar.bz2
GT5-Unofficial-9360d6afe97e029001f411d819f6d80dafdc95a3.zip
Revoctor Structure util to new package, fix typo
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaDequantizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/compatibility/thaumcraft/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_essentiaQuantizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java47
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java (renamed from src/main/java/com/github/technus/tectech/mechanics/constructible/IConstructable.java)5
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java30
-rw-r--r--src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java526
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java115
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_annihilation.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_bhg.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_collider.java12
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_computer.java18
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_crafting.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dataBank.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_decay.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_infuser.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_junction.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_quantizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_research.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_scanner.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_stabilizer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_switch.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_transformer.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_wormhole.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_microwave.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_proccessingStack.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_TM_teslaCoil.java7
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_MetaTileEntity_MultiblockBase_EM.java4
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/em_machine/GT_MetaTileEntity_EM_machine.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java6
-rw-r--r--src/main/java/com/github/technus/tectech/util/Util.java522
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