diff options
| author | Tec <daniel112092@gmail.com> | 2020-04-25 23:12:49 +0200 |
|---|---|---|
| committer | Tec <daniel112092@gmail.com> | 2020-04-25 23:17:25 +0200 |
| commit | 43ca64a9e686b84d56225d1d5a08b81e637549b6 (patch) | |
| tree | a0152b05e39e604ff2d18b028f30c40e31d09699 /src/main/java/com | |
| parent | 06ba23f08d8a1694c102a4ccd44a562a95a3f76f (diff) | |
| download | GT5-Unofficial-43ca64a9e686b84d56225d1d5a08b81e637549b6.tar.gz GT5-Unofficial-43ca64a9e686b84d56225d1d5a08b81e637549b6.tar.bz2 GT5-Unofficial-43ca64a9e686b84d56225d1d5a08b81e637549b6.zip | |
new structure api
Diffstat (limited to 'src/main/java/com')
47 files changed, 1409 insertions, 676 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 eb9b97deee..df5054ab4a 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,6 +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.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; 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; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -143,7 +143,7 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } }
\ No newline at end of file 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 0259aec7a7..d48c345e8e 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,6 +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.mechanics.structure.Structure; import com.github.technus.tectech.util.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.compatibility.thaumcraft.elementalMatter.definitions.ePrimalAspectDefinition; @@ -11,7 +11,7 @@ import com.github.technus.tectech.thing.casing.TT_Container_Casings; 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; +import com.github.technus.tectech.mechanics.structure.IHatchAdder; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -147,7 +147,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public String[] getStructureDescription(int stackSize) { + public String[] getStructureDescription(ItemStack stackSize) { return description; } }
\ No newline at end of file diff --git a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java index 93752cc02f..665889dc1f 100644 --- a/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ConstructableLoader.java @@ -2,7 +2,7 @@ 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 com.github.technus.tectech.mechanics.structure.Structure; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_ElectricBlastFurnace; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -39,7 +39,7 @@ public class ConstructableLoader implements Runnable { } @Override - public String[] getDescription(int stackSize) { + public String[] getDescription(ItemStack stackSize) { return desc; } }); diff --git a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java index 5c8c902484..2a93bcc540 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java +++ b/src/main/java/com/github/technus/tectech/mechanics/alignment/enumerable/ExtendedFacing.java @@ -12,7 +12,6 @@ import static com.github.technus.tectech.mechanics.alignment.IAlignment.FLIPS_CO import static com.github.technus.tectech.mechanics.alignment.IAlignment.ROTATIONS_COUNT; import static java.lang.Math.abs; import static java.util.Arrays.stream; -import static java.util.stream.Collectors.reducing; import static java.util.stream.Collectors.toMap; public enum ExtendedFacing { @@ -144,32 +143,32 @@ public enum ExtendedFacing { switch (direction){ case DOWN: a= ForgeDirection.WEST; - b= ForgeDirection.NORTH; + b= ForgeDirection.SOUTH; c= ForgeDirection.UP; break; case UP: a= ForgeDirection.EAST; - b= ForgeDirection.NORTH; + b= ForgeDirection.SOUTH; c= ForgeDirection.DOWN; break; case NORTH: a= ForgeDirection.WEST; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.SOUTH; break; case SOUTH: a= ForgeDirection.EAST; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.NORTH; break; case WEST: a= ForgeDirection.SOUTH; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.EAST; break; case EAST: a= ForgeDirection.NORTH; - b= ForgeDirection.UP; + b= ForgeDirection.DOWN; c= ForgeDirection.WEST; break; default:throw new RuntimeException("Is impossible..."); @@ -187,7 +186,7 @@ public enum ExtendedFacing { default:throw new RuntimeException("Even more impossible..."); } switch (rotation) { - case COUNTER_CLOCKWISE: { + case CLOCKWISE: { ForgeDirection _a=a; a =b; b =_a.getOpposite(); @@ -197,7 +196,7 @@ public enum ExtendedFacing { a=a.getOpposite(); b=b.getOpposite(); break; - case CLOCKWISE: { + case COUNTER_CLOCKWISE: { ForgeDirection _a=a; a =b.getOpposite(); b =_a; diff --git a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java index d7c3c86098..1de0381f1f 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IConstructable.java @@ -11,6 +11,6 @@ public interface IConstructable { void construct(ItemStack stackSize, boolean hintsOnly); @SideOnly(Side.CLIENT) - String[] getStructureDescription(int stackSize); + String[] getStructureDescription(ItemStack 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 index 29769fafb8..2506342f72 100644 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java +++ b/src/main/java/com/github/technus/tectech/mechanics/constructable/IMultiblockInfoContainer.java @@ -26,5 +26,5 @@ public interface IMultiblockInfoContainer { void construct(ItemStack stackSize, boolean hintsOnly, TileEntity tileEntity, ExtendedFacing aSide); @SideOnly(Side.CLIENT) - String[] getDescription(int stackSize); + String[] getDescription(ItemStack 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 deleted file mode 100644 index 00ffb32525..0000000000 --- a/src/main/java/com/github/technus/tectech/mechanics/constructable/Structure.java +++ /dev/null @@ -1,526 +0,0 @@ -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. - |
