diff options
author | Technus <daniel112092@gmail.com> | 2017-03-25 00:55:15 +0100 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-03-25 00:55:15 +0100 |
commit | 1a9336579897a08170452b2dd2d461da9eb43bc4 (patch) | |
tree | 681575e8cb3abb4009c010cfd3021c988065b167 | |
parent | ee592d1f1dd1de2c80a31cd17c847fa69dc2e077 (diff) | |
download | GT5-Unofficial-1a9336579897a08170452b2dd2d461da9eb43bc4.tar.gz GT5-Unofficial-1a9336579897a08170452b2dd2d461da9eb43bc4.tar.bz2 GT5-Unofficial-1a9336579897a08170452b2dd2d461da9eb43bc4.zip |
Added constructable interface and debug builder
17 files changed, 252 insertions, 92 deletions
diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index f1be2a0c10..550e262ccd 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -6,6 +6,7 @@ import com.github.technus.tectech.loader.Main; import com.github.technus.tectech.proxy.CommonProxy; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.thing.item.DebugBuilder; import com.github.technus.tectech.thing.item.DebugContainer_EM; import com.github.technus.tectech.thing.machineTT; import cpw.mods.fml.common.Loader; @@ -79,6 +80,7 @@ public class TecTech { QuantumGlass.run(); DebugContainer_EM.run(); + DebugBuilder.run(); GTCustomLoader = new Main(); GTCustomLoader.run(); @@ -104,12 +106,14 @@ public class TecTech { RegisterThingsInTabs(); if (Loader.isModLoaded("dreamcraft")) ;//TODO init recipes for GTNH coremod + else ;//TODO init recipes for NON-GTNH version } public void RegisterThingsInTabs() { QuantumGlass.INSTANCE.setCreativeTab(mainTab); GT_Container_CasingsTT.sBlockCasingsTT.setCreativeTab(mainTab); DebugContainer_EM.INSTANCE.setCreativeTab(mainTab); + DebugBuilder.INSTANCE.setCreativeTab(mainTab); } /** diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index 313106f64b..424b8c8589 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -12,8 +12,6 @@ import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.List; /** @@ -37,17 +35,18 @@ public class Util { //Check Machine Structure based on string[][] (effectively char[][][]), ond offset of the controller //This only checks for REGULAR BLOCKS! - public static boolean StuctureCheck(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 forceCheck) { + public static boolean StuctureChecker(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 forceCheck) { //TE Rotation byte facing = aBaseMetaTileEntity.getFrontFacing(); World world=aBaseMetaTileEntity.getWorld(); + if(world.isRemote)return false; - int x, y, z, a, b, c, yPos; + int x, y, z, a, b, c; //a,b,c - relative to block face! //x,y,z - relative to block position on map! //yPos - absolute height of checked block @@ -64,41 +63,41 @@ public class Util { } else { //get x y z from rotation switch (facing) {//translation - case 4: x = +c; z = +a; y = +b; break; - case 3: x = +a; z = -c; y = +b; break; - case 5: x = -c; z = -a; y = +b; break; - case 2: x = -a; z = +c; y = +b; break; + case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; //Things get odd if the block faces up or down... - case 1: x = +a; y = -c; z = +b; break;//similar to 3 - case 0: x = -a; y = +c; z = -b; break;//similar to 2 + case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 + case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 default: return false; } + //that must be here since in some cases other axis (b,c) controls y - yPos=aBaseMetaTileEntity.getYCoord()+y; - if(yPos<0 || yPos>=256) return false; + if(y<0 || y>=256) return false; //Check block if (world.blockExists(x,y,z)) {//this actually checks if the chunk is loaded at this pos switch (block) { case '-'://must be air - if (getBlockOffset(aBaseMetaTileEntity, x, y, z, world).getMaterial() != Material.air) + if (world.getBlock(x, y, z).getMaterial() != Material.air) return false; break; case '+'://must not be air - if (getBlockOffset(aBaseMetaTileEntity, x, y, z, world).getMaterial() == Material.air) + if (world.getBlock(x, y, z).getMaterial() == Material.air) return false; break; default: {//check for block (countable) int pointer = block - '0'; //countable air -> net.minecraft.block.BlockAir - if (getBlockOffset(aBaseMetaTileEntity,x,y,z,world) != blockType[pointer]) { + if (world.getBlock(x, y, z) != blockType[pointer]) { if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + getBlockOffset(aBaseMetaTileEntity,x,y,z,world) + " " + blockType[pointer]); + TecTech.Logger.info("Struct-block-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + world.getBlock(x, y, z) + " " + blockType[pointer]); return false; } - if (getMetaIDOffset(aBaseMetaTileEntity,x,y,z,world) != blockMeta[pointer]) { + if (world.getBlockMetadata(x, y, z) != blockMeta[pointer]) { if (TecTech.ModConfig.DEBUG_MODE) - TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + getMetaIDOffset(aBaseMetaTileEntity,x,y,z,world) + " " + blockMeta[pointer]); + TecTech.Logger.info("Struct-meta-id-error " + x + " " + y + " " + z + "/" + a + " " + c + "/" + world.getBlockMetadata(x, y, z) + " " + blockMeta[pointer]); return false; } } @@ -114,16 +113,81 @@ public class Util { return true; } - public static String[] ReverseStructureCheck(IGregTechTileEntity aBaseMetaTileEntity, - int horizontalOffset, int verticalOffset, int depthOffset, - int horizontalSize, int verticalSize, int depthSize){ + public static boolean StuctureBuilder(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) { + //TE Rotation + byte facing = aBaseMetaTileEntity.getFrontFacing(); + World world=aBaseMetaTileEntity.getWorld(); + if(world.isRemote)return false; + + int x, y, z, a, b, c; + //a,b,c - relative to block face! + //x,y,z - relative to block position on map! + + //perform your duties + c = -depthOffset; + for (String[] _structure : structure) {//front to back + b = verticalOffset; + for (String __structure : _structure) {//top to bottom + a = -horizontalOffset; + for (char block : __structure.toCharArray()) {//left to right + if (block > '`') {//characters allow to skip check a-1 skip, b-2 skips etc. + a += block - '`'; + } else { + //get x y z from rotation + switch (facing) {//translation + case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; + //Things get odd if the block faces up or down... + case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 + case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 + default: return false; + } + + //that must be here since in some cases other axis (b,c) controls y + if(y<0 || y>=256) return false; + + //Check block + if (world.blockExists(x,y,z)) {//this actually checks if the chunk is loaded + switch (block) { + case '-'://must be air + world.setBlock(x,y,z,Blocks.air,0,3); + break; + case '+'://must not be air + world.setBlock(x,y,z,Blocks.glass,0,3); + default: {//check for block (countable) + int pointer = block - '0'; + //countable air -> net.minecraft.block.BlockAir + world.setBlock(x,y,z,blockType[pointer],blockMeta[pointer],3); + } + } + } + a++;//block in horizontal layer + } + } + b--;//horizontal layer + } + c++;//depth + } + return true; + } + + public static String[] StructureWriter(IGregTechTileEntity aBaseMetaTileEntity, + int horizontalOffset, int verticalOffset, int depthOffset, + int horizontalSize, int verticalSize, int depthSize){ //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,yPos; + int x, y, z, a, b, c; //a,b,c - relative to block face! //x,y,z - relative to block position on map! //yPos - absolute height of checked block @@ -137,21 +201,22 @@ public class Util { for (int az=0;az<horizontalSize;az++) {//left to right //get x y z from rotation switch (facing) {//translation - case 4: x = +c; z = +a; y = +b; break; - case 3: x = +a; z = -c; y = +b; break; - case 5: x = -c; z = -a; y = +b; break; - case 2: x = -a; z = +c; y = +b; break; + case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; //Things get odd if the block faces up or down... - case 1: x = +a; y = -c; z = +b; break;//similar to 3 - case 0: x = -a; y = +c; z = -b; break;//similar to 2 - default: return new String[]{"Invalid facing"}; + case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 + case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 + default: return new String[]{"Invalid rotation"}; } - //that must be here since in some cases other axis (a,b,c) controls y - yPos=aBaseMetaTileEntity.getYCoord()+y; - if(yPos<0 || yPos>=256) return new String[]{"Invalid position"}; + + //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=getBlockOffset(aBaseMetaTileEntity,x,y,z,world); - int meta=getMetaIDOffset(aBaseMetaTileEntity,x,y,z,world); + 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; @@ -178,10 +243,24 @@ public class Util { List<String> output=new ArrayList<>(); - output.add("Block[] MetaID[]"); + output.add("Offsets: "+horizontalOffset+" "+verticalOffset+" "+depthOffset); + output.add("Sizes: "+horizontalSize+" "+verticalSize+" "+depthSize); output.add(""); - for(ItemStack is:array){ - if(is!=null) output.add(is.getUnlocalizedName()+" "+is.getItemDamage()); + + 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[][]"); @@ -196,22 +275,19 @@ public class Util { for (int az=0;az<horizontalSize;az++) {//left to right //get x y z from rotation switch (facing) {//translation - case 4: x = +c; z = +a; y = +b; break; - case 3: x = +a; z = -c; y = +b; break; - case 5: x = -c; z = -a; y = +b; break; - case 2: x = -a; z = +c; y = +b; break; + case 4: x = aBaseMetaTileEntity.getXCoord()+c; z = aBaseMetaTileEntity.getZCoord()+a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 3: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()-c; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 5: x = aBaseMetaTileEntity.getXCoord()-c; z = aBaseMetaTileEntity.getZCoord()-a; y = aBaseMetaTileEntity.getYCoord()+b; break; + case 2: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()+c; y = aBaseMetaTileEntity.getYCoord()+b; break; //Things get odd if the block faces up or down... - case 1: x = +a; y = -c; z = +b; break;//similar to 3 - case 0: x = -a; y = +c; z = -b; break;//similar to 2 - default: return new String[]{"Invalid facing"}; + case 1: x = aBaseMetaTileEntity.getXCoord()+a; z = aBaseMetaTileEntity.getZCoord()+b; y = aBaseMetaTileEntity.getYCoord()-c; break;//similar to 3 + case 0: x = aBaseMetaTileEntity.getXCoord()-a; z = aBaseMetaTileEntity.getZCoord()-b; y = aBaseMetaTileEntity.getYCoord()+c; break;//similar to 2 + default: return new String[]{"Invalid rotation"}; } - //that must be here since in some cases other axis (a,b,c) controls y - //yPos=aBaseMetaTileEntity.getYCoord()+y; - //if(yPos<0 || yPos>=256) return new String[]{"Invalid position"}; - //Check block - Block block=getBlockOffset(aBaseMetaTileEntity,x,y,z,world); - int meta=getMetaIDOffset(aBaseMetaTileEntity,x,y,z,world); + //Check block + Block block=world.getBlock(x,y,z); + int meta=world.getBlockMetadata(x,y,z); if(a==0 && b==0 && c==0){ line+='X'; @@ -241,14 +317,6 @@ public class Util { return output.toArray(new String[0]); } - private static Block getBlockOffset(IGregTechTileEntity a,int x,int y,int z,World w){ - return w.getBlock(a.getXCoord()+x,a.getYCoord()+y,a.getZCoord()+z); - } - - private static int getMetaIDOffset(IGregTechTileEntity a,int x,int y,int z,World w){ - return w.getBlockMetadata(a.getXCoord()+x,a.getYCoord()+y,a.getZCoord()+z); - } - public static boolean isInputEqual(boolean aDecreaseStacksizeBySuccess, boolean aDontCheckStackSizes, FluidStack[] requiredFluidInputs, ItemStack[] requiredInputs, FluidStack[] givenFluidInputs, ItemStack... givenInputs) { if (!GregTech_API.sPostloadFinished) return false; if (requiredFluidInputs.length > 0 && givenFluidInputs == null) return false; diff --git a/src/main/java/com/github/technus/tectech/loader/Machines.java b/src/main/java/com/github/technus/tectech/loader/Machines.java index 64110a69bf..74157cd1cf 100644 --- a/src/main/java/com/github/technus/tectech/loader/Machines.java +++ b/src/main/java/com/github/technus/tectech/loader/Machines.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.loader; -import com.github.technus.tectech.TecTech; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.*; import com.github.technus.tectech.thing.metaTileEntity.pipe.GT_MetaTileEntity_Pipe_Data; diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index 525fcbd7e3..c655d78fb2 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -29,7 +29,7 @@ public enum CustomItemList implements IItemContainer { eM_out_UV, eM_out_UHV, eM_out_UEV, eM_out_UIV, eM_out_UMV, eM_out_UXV, eM_muffler_UV, eM_muffler_UHV, eM_muffler_UEV, eM_muffler_UIV, eM_muffler_UMV, eM_muffler_UXV, Parametrizer_Hatch, Uncertainty_Hatch, UncertaintyX_Hatch, dataIn_Hatch, dataOut_Hatch, - eM_Casing, eM_Field, eM_Field_Casing, eM_Coil, eM_Tele, eM_TimeSpaceWarp, eM_computer, eM_computerAdv, eM_computerVent, + eM_Casing, eM_Field, eM_Field_Casing, eM_Coil, eM_Tele, eM_TimeSpaceWarp, eM_computer, eM_computerAdv, eM_computerVent, eM_Hollow, debugBlock, Machine_Multi_MatterToEM, Machine_Multi_EMToMatter, Machine_Multi_EMjunction, Machine_Multi_Transformer, Machine_Multi_Computer, Machine_Multi_Infuser, Machine_Multi_Switch, diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index d369b681ed..16090589da 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -23,7 +23,7 @@ import java.util.List; public class GT_Block_CasingsTT extends GT_Block_Casings_Abstract { - private static IIcon eM0s,eM1s,eM2s,eM0,eM1,eM2,eM3, eM4, eM5, eM6, eM7, eM8, eM9; + private static IIcon eM0s,eM1s,eM2s,eM0,eM1,eM2,eM3, eM4, eM5, eM6s, eM6, eM7, eM8, eM9; private static IIcon debug[] = new IIcon[6]; public GT_Block_CasingsTT() { @@ -42,8 +42,9 @@ public class GT_Block_CasingsTT GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".6.name", "Molecular Containment Coil");//adding GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Teleportation Casing");//adding GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Spacetime Altering Casing");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Collider Hollow Casing");//adding - GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Debug Sides");//adding + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Debug Sides");//adding CustomItemList.eM_computer.set(new ItemStack(this, 1, 0));//adding @@ -55,27 +56,28 @@ public class GT_Block_CasingsTT CustomItemList.eM_Coil.set(new ItemStack(this, 1, 6));//adding CustomItemList.eM_Tele.set(new ItemStack(this, 1, 7));//adding CustomItemList.eM_TimeSpaceWarp.set(new ItemStack(this, 1, 8)); + CustomItemList.eM_Hollow.set(new ItemStack(this, 1, 9)); - CustomItemList.debugBlock.set(new ItemStack(this, 1, 9)); + CustomItemList.debugBlock.set(new ItemStack(this, 1, 10)); } @Override public void registerBlockIcons(IIconRegister aIconRegister) { //super.registerBlockIcons(aIconRegister); - eM0s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC"); - eM1s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_ADV"); - eM2s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_VENT"); eM0 = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_NONSIDE"); + eM0s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC"); eM1 = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_ADV_NONSIDE"); + eM1s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_ADV"); eM2 = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_VENT_NONSIDE"); + eM2s = aIconRegister.registerIcon("gregtech:iconsets/EM_PC_VENT"); eM3 = aIconRegister.registerIcon("gregtech:iconsets/EM_CASING"); eM4 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD"); eM5 = aIconRegister.registerIcon("gregtech:iconsets/EM_FIELD_CASING"); - eM6 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL"); - eM7 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL_NONSIDE"); - eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); - eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); - eM9 = aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); + eM6 = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL_NONSIDE"); + eM6s = aIconRegister.registerIcon("gregtech:iconsets/EM_COIL"); + eM7 = aIconRegister.registerIcon("gregtech:iconsets/EM_TELE"); + eM8 = aIconRegister.registerIcon("gregtech:iconsets/EM_TIMESPACE"); + eM9 = aIconRegister.registerIcon("gregtech:iconsets/EM_HOLLOW"); debug[0] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_0"); debug[1] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_1"); @@ -103,13 +105,15 @@ public class GT_Block_CasingsTT case 5: return eM5; case 6: - if (aSide < 2) return eM7; - return eM6; + if (aSide < 2) return eM6; + return eM6s; case 7: - return eM8; + return eM7; case 8: - return eM9; + return eM8; case 9: + return eM9; + case 10: return debug[aSide]; default: return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon(); @@ -128,7 +132,7 @@ public class GT_Block_CasingsTT @Override public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List aList) { - for (int i = 0; i <= 9; i++) { + for (int i = 0; i <= 10; i++) { aList.add(new ItemStack(aItem, 1, i)); } } diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugBuilder.java b/src/main/java/com/github/technus/tectech/thing/item/DebugBuilder.java new file mode 100644 index 0000000000..434ff91953 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugBuilder.java @@ -0,0 +1,61 @@ +package com.github.technus.tectech.thing.item; + +import com.github.technus.tectech.elementalMatter.CommonValues; +import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; +import com.github.technus.tectech.thing.metaTileEntity.constructableTT; +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.List; + +import static com.github.technus.tectech.auxiliary.Reference.MODID; + +/** + * Created by Tec on 15.03.2017. + */ +public class DebugBuilder extends Item { + public static DebugBuilder INSTANCE; + + DebugBuilder(){ + super(); + setMaxStackSize(1); + setUnlocalizedName("em.debugBuilder"); + setTextureName(MODID + ":itemDebugBuilder"); + } + + @Override + public boolean onItemUseFirst(ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (aPlayer instanceof EntityPlayerMP) { + aStack.stackSize = 1; + if (tTileEntity != null && tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (metaTE != null && metaTE instanceof constructableTT) { + ((constructableTT) metaTE).construct(); + return true; + } + } + } + return aPlayer instanceof EntityPlayerMP; + } + + @Override + public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) { + aList.add(CommonValues.tecMark); + aList.add("Constructs Multiblocks"); + } + + public static void run(){ + INSTANCE=new DebugBuilder(); + GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName()); + } +} diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java index 6af497f3c9..8c04558ed1 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugContainer_EM.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.item; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -61,8 +61,8 @@ public class DebugContainer_EM extends Item { tNBT.setTag("content", content.toNBT()); content.clear(); } + return true; } - return true; } } return aPlayer instanceof EntityPlayerMP; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/constructableTT.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/constructableTT.java new file mode 100644 index 0000000000..9e737e2aa4 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/constructableTT.java @@ -0,0 +1,8 @@ +package com.github.technus.tectech.thing.metaTileEntity; + +/** + * Created by Tec on 24.03.2017. + */ +public interface constructableTT { + void construct(); +} diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index 6d3347c182..8d21cdee5e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,9 +1,9 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.interfaces.iElementalInstanceContainer; import com.github.technus.tectech.thing.machineTT; import com.github.technus.tectech.thing.metaTileEntity.pipe.iConnectsToEMpipe; 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 f33406819d..c4a99446a0 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 @@ -3,6 +3,7 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.thing.block.QuantumGlass; import com.github.technus.tectech.thing.casing.GT_Container_CasingsTT; +import com.github.technus.tectech.thing.metaTileEntity.constructableTT; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,12 +14,13 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import static com.github.technus.tectech.Util.StuctureBuilder; import static gregtech.api.enums.GT_Values.E; /** * Created by danie_000 on 17.12.2016. */ -public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_EM { +public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_EM implements constructableTT { private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT @@ -64,6 +66,11 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E } @Override + public void construct() { + StuctureBuilder(shape,blockType,blockMeta,7,7,0,this.getBaseMetaTileEntity()); + } + + @Override public void registerIcons(IIconRegister aBlockIconRegister) { ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_ACTIVE"); 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 4e853181fc..10c985da0b 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,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.definitions.dAtomDefinition; import com.github.technus.tectech.elementalMatter.definitions.dHadronDefinition; import com.github.technus.tectech.elementalMatter.definitions.eLeptonDefinition; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java index 4e1d01e704..a16425cb93 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_MultiblockBase_EM.java @@ -1,11 +1,11 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.TecTech; +import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.elementalMatter.classes.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStack; import com.github.technus.tectech.elementalMatter.classes.cElementalInstanceStackTree; import com.github.technus.tectech.elementalMatter.classes.tElementalException; -import com.github.technus.tectech.elementalMatter.CommonValues; import com.github.technus.tectech.thing.machineTT; import com.github.technus.tectech.thing.metaTileEntity.hatch.*; import com.github.technus.tectech.thing.metaTileEntity.multi.gui.GT_Container_MultiMachineEM; @@ -31,7 +31,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; -import static com.github.technus.tectech.Util.StuctureCheck; +import static com.github.technus.tectech.Util.StuctureChecker; import static com.github.technus.tectech.elementalMatter.CommonValues.*; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.VN; @@ -1212,7 +1212,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Block[] blockType,//use numbers 0-9 for casing types byte[] blockMeta,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset){ - return StuctureCheck(structure,blockType,blockMeta,horizontalOffset,verticalOffset,depthOffset,getBaseMetaTileEntity(),!mMachine); + return StuctureChecker(structure,blockType,blockMeta,horizontalOffset,verticalOffset,depthOffset,getBaseMetaTileEntity(),!mMachine); } @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 e38c05915d..9163927deb 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 @@ -10,17 +10,19 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import static com.github.technus.tectech.Util.ReverseStructureCheck; +import static com.github.technus.tectech.Util.StructureWriter; /** * Created by Tec on 23.03.2017. */ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_TieredMachineBlock { + private static Textures.BlockIcons.CustomIcon MARK; public short numbers[]=new short[6]; public boolean size=false; public String[] result=new String[]{"Undefined"}; @@ -39,8 +41,14 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti } @Override + public void registerIcons(IIconRegister aBlockIconRegister) { + super.registerIcons(aBlockIconRegister); + MARK = new Textures.BlockIcons.CustomIcon("iconsets/MARK"); + } + + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != this.getBaseMetaTileEntity().getFrontFacing()) ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES) : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != this.getBaseMetaTileEntity().getFrontFacing()) ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES) : new GT_RenderedTexture(MARK)}; } @Override @@ -90,7 +98,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if(aBaseMetaTileEntity.isAllowedToWork()){ - result=ReverseStructureCheck(this.getBaseMetaTileEntity(),numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5]); + result= StructureWriter(this.getBaseMetaTileEntity(),numbers[0],numbers[1],numbers[2],numbers[3],numbers[4],numbers[5]); if(TecTech.ModConfig.DEBUG_MODE) for(String s:result) TecTech.Logger.info(s); diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_HOLLOW.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_HOLLOW.png Binary files differnew file mode 100644 index 0000000000..3970b1ec67 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/EM_HOLLOW.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/MARK.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MARK.png Binary files differnew file mode 100644 index 0000000000..5b9a8d85c6 --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/MARK.png diff --git a/src/main/resources/assets/tectech/lang/en_US.lang b/src/main/resources/assets/tectech/lang/en_US.lang index 87a1a1b89d..691a8e5bff 100644 --- a/src/main/resources/assets/tectech/lang/en_US.lang +++ b/src/main/resources/assets/tectech/lang/en_US.lang @@ -1,3 +1,4 @@ itemGroup.TecTech=TecTech Interdimensional tile.quantumGlass.name=Quantum Glass item.em.debugContainer.name=Debug EM Container +item.em.debugBuilder.name=Debug Builder diff --git a/src/main/resources/assets/tectech/textures/items/itemDebugBuilder.png b/src/main/resources/assets/tectech/textures/items/itemDebugBuilder.png Binary files differnew file mode 100644 index 0000000000..ceac5d0ba5 --- /dev/null +++ b/src/main/resources/assets/tectech/textures/items/itemDebugBuilder.png |