diff options
author | Bass <tudurap.com@gmail.com> | 2019-08-30 04:59:29 +0100 |
---|---|---|
committer | Bass <tudurap.com@gmail.com> | 2019-08-30 04:59:29 +0100 |
commit | 9002ca978f851fce53f81773ba290a82fea0f027 (patch) | |
tree | 9ec868d421ba2cf654c98878c500fd6ed7c57571 /src/main/java/com | |
parent | cec23e300f5dbfc443d6daa624015b6baa359737 (diff) | |
download | GT5-Unofficial-9002ca978f851fce53f81773ba290a82fea0f027.tar.gz GT5-Unofficial-9002ca978f851fce53f81773ba290a82fea0f027.tar.bz2 GT5-Unofficial-9002ca978f851fce53f81773ba290a82fea0f027.zip |
Unethical Housekeeping Procedure
Forgive me father, for I have sinned.
Diffstat (limited to 'src/main/java/com')
23 files changed, 2112 insertions, 2066 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 d3a8138686..4074f2d6db 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 @@ -35,8 +35,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, @@ -77,42 +76,11 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ } @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return essentiaContainerCompat.check(this) && structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - 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, this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { TileEntity container = essentiaContainerCompat.getContainer(this); if (eInputHatches.size() < 1 || container == null) { @@ -147,4 +115,35 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.emtoessentia.desc.1")//regular one, but why? }; } + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return GT_MetaTileEntity_EM_quantizer.activitySound; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (hintsOnly) { + TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + TT_Container_Casings.sHintCasingsTT, 12); + } else { + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { + 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, this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int 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 696242adff..0caf4be6d6 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 @@ -35,8 +35,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, @@ -72,12 +71,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_essentiaQuantizer(mName); } @@ -88,40 +81,6 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu } @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - 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, this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.0"),//Conveniently convert regular stuff into quantum form. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.1")//To make it more inconvenient. - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { TileEntity container = essentiaContainerCompat.getContainer(this); cElementalInstanceStack newStack = essentiaContainerCompat.getFromContainer(container); @@ -151,4 +110,44 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); outputEM = null; } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.0"),//Conveniently convert regular stuff into quantum form. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.essentiatoem.desc.1")//To make it more inconvenient. + }; + } + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return GT_MetaTileEntity_EM_quantizer.activitySound; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ; + if (hintsOnly) { + TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + TT_Container_Casings.sHintCasingsTT, 12); + } else { + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { + 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, this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 ece8c6ba82..023bcb3a20 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 @@ -26,31 +26,33 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //endregion //region structure private static final String[][] shape = new String[][]{ - {"\u0002","D000","C0 0","C0 . 0","C0 0","D000"}, - {"C01A10","C01A10","D1A1","00B101B00","11111111111","C01110","11111111111","00B101B00","D1A1","C01A10","C01A10",}, - {"C01A10","A223222322","A244242442","03442424430","12225252221","A244222442","12225252221","03442424430","A244242442","A223222322","C01A10",}, - {"D111","A244222442","A4G4","A4G4","12G21","12G21","12G21","A4G4","A4G4","A244222442","D111",}, - {"A0C0C0","03444244430","A4G4","A4G4","A4G4","02G20","A4G4","A4G4","A4G4","03444244430","A0C0C0",}, - {"00C!C00","02444544420","A4G4","A4G4","A4G4","!5G5!","A4G4","A4G4","A4G4","02444544420","00C!C00",}, - {"A0C0C0","03444244430","A4G4","A4G4","A4G4","02G20","A4G4","A4G4","A4G4","03444244430","A0C0C0",}, - {"D111","A244222442","A4G4","A4G4","12G21","12G21","12G21","A4G4","A4G4","A244222442","D111",}, - {"C01A10","A223222322","A244242442","03442424430","12225252221","A244222442","12225252221","03442424430","A244242442","A223222322","C01A10",}, - {"C01A10","C01A10","D1A1","00B101B00","11111111111","C01110","11111111111","00B101B00","D1A1","C01A10","C01A10",}, - {"\u0002","D000","C0 0","C0 0","C0 0","D000"}, + {"\u0002", "D000", "C0 0", "C0 . 0", "C0 0", "D000"}, + {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, + {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, + {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, + {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, + {"00C!C00", "02444544420", "A4G4", "A4G4", "A4G4", "!5G5!", "A4G4", "A4G4", "A4G4", "02444544420", "00C!C00",}, + {"A0C0C0", "03444244430", "A4G4", "A4G4", "A4G4", "02G20", "A4G4", "A4G4", "A4G4", "03444244430", "A0C0C0",}, + {"D111", "A244222442", "A4G4", "A4G4", "12G21", "12G21", "12G21", "A4G4", "A4G4", "A244222442", "D111",}, + {"C01A10", "A223222322", "A244242442", "03442424430", "12225252221", "A244222442", "12225252221", "03442424430", "A244242442", "A223222322", "C01A10",}, + {"C01A10", "C01A10", "D1A1", "00B101B00", "11111111111", "C01110", "11111111111", "00B101B00", "D1A1", "C01A10", "C01A10",}, + {"\u0002", "D000", "C0 0", "C0 0", "C0 0", "D000"}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT ,sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 5, 12, 6, 0, 10}; private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", "2 - Elemental Hatches or Molecular Casing", }; @@ -70,6 +72,20 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl } @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Things+Anti Things don't like each other.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Matter into power!" + }; + } + + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_ANNIHILATION"); @@ -86,26 +102,12 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl } @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 5, 5, 0); - } - - @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0,getBaseMetaTileEntity(),this,hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 5, 5, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override public String[] getStructureDescription(int stackSize) { return description; } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Things+Anti Things don't like each other.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Matter into power!" - }; - } -} +}
\ No newline at end of file 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 972f44fd85..37e5beed5a 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 @@ -29,106 +29,108 @@ 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 implements IConstructable { + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - private static final double NEUTRONIUM_BLOCK_MASS =4.1E17; - private static final double NEUTRONIUM_BLOCK_ATOM_COUNT =2.4478671E44; - private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS /(URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 + private static final double NEUTRONIUM_BLOCK_MASS = 4.1E17; + private static final double NEUTRONIUM_BLOCK_ATOM_COUNT = 2.4478671E44; + private static final double NEUTRONIUM_BLOCK_TO_EU_INSTANT = URANIUM_MASS_TO_EU_INSTANT * NEUTRONIUM_BLOCK_MASS / (URANIUM_INGOT_MASS_DIFF * 1.78266191e-36);//~ 5.314e40 private static final double NEUTRON_TO_EU_INSTANT = NEUTRONIUM_BLOCK_TO_EU_INSTANT / NEUTRONIUM_BLOCK_ATOM_COUNT;//~ 0.00021708694 - public boolean glassDome=false; + public boolean glassDome = false; + //endregion //Time dillatation - to slow down the explosion thing but REALLY REDUCE POWER OUTPUT //Startcodes to startup //per dim disable thingies - //region Structure actual + //region structure actual private static final String[][] shape = new String[][]{ - {"\u000B","M0000000","L00 00","L0 0","L0 !!! 0","L0 !.! 0","L0 !!! 0","L0 0","L00 00","M0000000",}, - {"\u0008","O0A0","O0A0","O0A0","O0A0","N11111","M1101011","I000010010010000","M1111111","I000010010010000","M1101011","N11111","O0A0","O0A0","O0A0","O0A0",}, - {"\u0006","O0A0","O0A0","O0A0","P1","P1","M1111111","L11E11","L1B222B1","G000B1A23332A1B000","J111A23332A111","G000B1A23332A1B000","L1B222B1","L11E11","M1111111","P1","P1","O0A0","O0A0","O0A0",}, - {"\u0005","O0A0","O0A0","P1","P1","\u0004","F00Q00","H11M11","F00Q00","\u0004","P1","P1","O0A0","O0A0",}, - {"\u0004","O0A0","N00000","P1","P4","P4","\u0003","F0S0","E00S00","F0144M4410","E00S00","F0S0","\u0003","P4","P4","P1","N00000","O0A0",}, - {"\u0003","O0A0","O0A0","P1","M2224222","\u0004","G2Q2","G2Q2","D00A2Q2A00","F14Q41","D00A2Q2A00","G2Q2","G2Q2","\u0004","M2224222","P1","O0A0","O0A0",}, - {"\u0002","O0A0","N00000","P1","P4","\u0006","D0W0","C00W00","D014S410","C00W00","D0W0","\u0006","P4","P1","N00000","O0A0",}, - {"\u0001","O0A0","O0A0","P1","M2224222","\u0006","E2U2","E2U2","B00A2U2A00","D14U41","B00A2U2A00","E2U2","E2U2","\u0006","M2224222","P1","O0A0","O0A0",}, - {"\u0001","O0A0","P1","P4","\u0009","B0[0","C14W41","B0[0","\u0009","P4","P1","O0A0",}, - {E,"O0A0","O0A0","P1","P4","\u0009","A00[00","C14W41","A00[00","\u0009","P4","P1","O0A0","O0A0",}, - {E,"O0A0","P1","\u000B","A0]0","B1[1","A0]0","\u000B","P1","O0A0",}, - {E,"O0A0","P1","\u000B","A0]0","B1[1","A0]0","\u000B","P1","O0A0",}, - {"O0A0","O0A0","M1111111","\u0009","B1[1","B1[1","001[100","B1[1","001[100","B1[1","B1[1","\u0009","M1111111","O0A0","O0A0",}, - {"O0A0","N11111","L11E11","\u0001","G2Q2",E,"E2U2","\u0003","B1[1","B1[1","A1]1","01]10","A1]1","01]10","A1]1","B1[1","B1[1","\u0003","E2U2",E,"G2Q2","\u0001","L11E11","N11111","O0A0",}, - {"O0A0","M1101011","L1B222B1",E,"F0S0","G2Q2","D0W0","E2U2","\u0003","B1[1","A1]1","A1]1","002[200","A12[21","002[200","A1]1","A1]1","B1[1","\u0003","E2U2","D0W0","G2Q2","F0S0",E,"L1B222B1","M1101011","O0A0",}, - {"L000000000","I000010010010000","G000B1A23332A1B000","F00Q00","E00S00","D00A2Q2A00","C00W00","B00A2U2A00","B0[0","A00[00","A0]0","A0]0","001[100","01]10","002[200","003[300","013[310","003[300","002[200","01]10","001[100","A0]0","A0]0","A00[00","B0[0","B00A2U2A00","C00W00","D00A2Q2A00","E00S00","F00Q00","G000B1A23332A1B000","I000010010010000","L000000000",}, - {"O0A0","M1111111","J111A23332A111","H11M11","F0144M4410","F14Q41","D014S410","D14U41","C14W41","C14W41","B1[1","B1[1","B1[1","A1]1","A12[21","013[310","A13[31","013[310","A12[21","A1]1","B1[1","B1[1","B1[1","C14W41","C14W41","D14U41","D014S410","F14Q41","F0144M4410","H11M11","J111A23332A111","M1111111","O0A0",}, - {"L000000000","I000010010010000","G000B1A23332A1B000","F00Q00","E00S00","D00A2Q2A00","C00W00","B00A2U2A00","B0[0","A00[00","A0]0","A0]0","001[100","01]10","002[200","003[300","013[310","003[300","002[200","01]10","001[100","A0]0","A0]0","A00[00","B0[0","B00A2U2A00","C00W00","D00A2Q2A00","E00S00","F00Q00","G000B1A23332A1B000","I000010010010000","L000000000",}, - {"O0A0","M1101011","L1B222B1",E,"F0S0","G2Q2","D0W0","E2U2","\u0003","B1[1","A1]1","A1]1","002[200","A12[21","002[200","A1]1","A1]1","B1[1","\u0003","E2U2","D0W0","G2Q2","F0S0",E,"L1B222B1","M1101011","O0A0",}, - {"O0A0","N11111","L11E11","\u0001","G2Q2",E,"E2U2","\u0003","B1[1","B1[1","A1]1","01]10","A1]1","01]10","A1]1","B1[1","B1[1","\u0003","E2U2",E,"G2Q2","\u0001","L11E11","N11111","O0A0",}, - {"O0A0","O0A0","M1111111","\u0009","B1[1","B1[1","001[100","B1[1","001[100","B1[1","B1[1","\u0009","M1111111","O0A0","O0A0",}, - {E,"O0A0","P1","\u000B","A0]0","B1[1","A0]0","\u000B","P1","O0A0",}, - {E,"O0A0","P1","\u000B","A0]0","B1[1","A0]0","\u000B","P1","O0A0",}, - {E,"O0A0","O0A0","P1","P4","\u0009","A00[00","C14W41","A00[00","\u0009","P4","P1","O0A0","O0A0",}, - {"\u0001","O0A0","P1","P4","\u0009","B0[0","C14W41","B0[0","\u0009","P4","P1","O0A0",}, - {"\u0001","O0A0","O0A0","P1","M2224222","\u0006","E2U2","E2U2","B00A2U2A00","D14U41","B00A2U2A00","E2U2","E2U2","\u0006","M2224222","P1","O0A0","O0A0",}, - {"\u0002","O0A0","N00000","P1","P4","\u0006","D0W0","C00W00","D014S410","C00W00","D0W0","\u0006","P4","P1","N00000","O0A0",}, - {"\u0003","O0A0","O0A0","P1","M2224222","\u0004","G2Q2","G2Q2","D00A2Q2A00","F14Q41","D00A2Q2A00","G2Q2","G2Q2","\u0004","M2224222","P1","O0A0","O0A0",}, - {"\u0004","O0A0","N00000","P1","P4","P4","\u0003","F0S0","E00S00","F0144M4410","E00S00","F0S0","\u0003","P4","P4","P1","N00000","O0A0",}, - {"\u0005","O0A0","O0A0","P1","P1","\u0004","F00Q00","H11M11","F00Q00","\u0004","P1","P1","O0A0","O0A0",}, - {"\u0006","O0A0","O0A0","O0A0","P1","P1","M1111111","L11E11","L1B222B1","G000B1A23332A1B000","J111A23332A111","G000B1A23332A1B000","L1B222B1","L11E11","M1111111","P1","P1","O0A0","O0A0","O0A0",}, - {"\u0008","O0A0","O0A0","O0A0","O0A0","N11111","M1101011","I000010010010000","M1111111","I000010010010000","M1101011","N11111","O0A0","O0A0","O0A0","O0A0",}, - {"\u000B","O0A0","O0A0","O0A0","L000000000","O0A0","L000000000","O0A0","O0A0","O0A0",}, + {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, + {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, + {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, + {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, + {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, + {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, + {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, + {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, + {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, + {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "M1111111", "J111A23332A111", "H11M11", "F0144M4410", "F14Q41", "D014S410", "D14U41", "C14W41", "C14W41", "B1[1", "B1[1", "B1[1", "A1]1", "A12[21", "013[310", "A13[31", "013[310", "A12[21", "A1]1", "B1[1", "B1[1", "B1[1", "C14W41", "C14W41", "D14U41", "D014S410", "F14Q41", "F0144M4410", "H11M11", "J111A23332A111", "M1111111", "O0A0",}, + {"L000000000", "I000010010010000", "G000B1A23332A1B000", "F00Q00", "E00S00", "D00A2Q2A00", "C00W00", "B00A2U2A00", "B0[0", "A00[00", "A0]0", "A0]0", "001[100", "01]10", "002[200", "003[300", "013[310", "003[300", "002[200", "01]10", "001[100", "A0]0", "A0]0", "A00[00", "B0[0", "B00A2U2A00", "C00W00", "D00A2Q2A00", "E00S00", "F00Q00", "G000B1A23332A1B000", "I000010010010000", "L000000000",}, + {"O0A0", "M1101011", "L1B222B1", E, "F0S0", "G2Q2", "D0W0", "E2U2", "\u0003", "B1[1", "A1]1", "A1]1", "002[200", "A12[21", "002[200", "A1]1", "A1]1", "B1[1", "\u0003", "E2U2", "D0W0", "G2Q2", "F0S0", E, "L1B222B1", "M1101011", "O0A0",}, + {"O0A0", "N11111", "L11E11", "\u0001", "G2Q2", E, "E2U2", "\u0003", "B1[1", "B1[1", "A1]1", "01]10", "A1]1", "01]10", "A1]1", "B1[1", "B1[1", "\u0003", "E2U2", E, "G2Q2", "\u0001", "L11E11", "N11111", "O0A0",}, + {"O0A0", "O0A0", "M1111111", "\u0009", "B1[1", "B1[1", "001[100", "B1[1", "001[100", "B1[1", "B1[1", "\u0009", "M1111111", "O0A0", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "P1", "\u000B", "A0]0", "B1[1", "A0]0", "\u000B", "P1", "O0A0",}, + {E, "O0A0", "O0A0", "P1", "P4", "\u0009", "A00[00", "C14W41", "A00[00", "\u0009", "P4", "P1", "O0A0", "O0A0",}, + {"\u0001", "O0A0", "P1", "P4", "\u0009", "B0[0", "C14W41", "B0[0", "\u0009", "P4", "P1", "O0A0",}, + {"\u0001", "O0A0", "O0A0", "P1", "M2224222", "\u0006", "E2U2", "E2U2", "B00A2U2A00", "D14U41", "B00A2U2A00", "E2U2", "E2U2", "\u0006", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0002", "O0A0", "N00000", "P1", "P4", "\u0006", "D0W0", "C00W00", "D014S410", "C00W00", "D0W0", "\u0006", "P4", "P1", "N00000", "O0A0",}, + {"\u0003", "O0A0", "O0A0", "P1", "M2224222", "\u0004", "G2Q2", "G2Q2", "D00A2Q2A00", "F14Q41", "D00A2Q2A00", "G2Q2", "G2Q2", "\u0004", "M2224222", "P1", "O0A0", "O0A0",}, + {"\u0004", "O0A0", "N00000", "P1", "P4", "P4", "\u0003", "F0S0", "E00S00", "F0144M4410", "E00S00", "F0S0", "\u0003", "P4", "P4", "P1", "N00000", "O0A0",}, + {"\u0005", "O0A0", "O0A0", "P1", "P1", "\u0004", "F00Q00", "H11M11", "F00Q00", "\u0004", "P1", "P1", "O0A0", "O0A0",}, + {"\u0006", "O0A0", "O0A0", "O0A0", "P1", "P1", "M1111111", "L11E11", "L1B222B1", "G000B1A23332A1B000", "J111A23332A111", "G000B1A23332A1B000", "L1B222B1", "L11E11", "M1111111", "P1", "P1", "O0A0", "O0A0", "O0A0",}, + {"\u0008", "O0A0", "O0A0", "O0A0", "O0A0", "N11111", "M1101011", "I000010010010000", "M1111111", "I000010010010000", "M1101011", "N11111", "O0A0", "O0A0", "O0A0", "O0A0",}, + {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 13, 14, 10, 11}; private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", "2 - Elemental Hatches or Molecular Casing", }; //endregion - //region Structure dank - glass sphere for the looks + //region structure dank - glass sphere for the looks private static final String[][] shape2 = new String[][]{ - {"\u000B","M0000000","L00 00","L0 0","L0 !!! 0","L0 !.! 0","L0 !!! 0","L0 0","L00 00","M0000000",}, - {"\u0008","O0A0","M110A011","L1110A0111","K11110A01111","J1111222221111","J1112202022111","I000020020020000","M2222222","I000020020020000","J1112202022111","J1111222221111","K11110A01111","L1110A0111","M110A011","O0A0",}, - {"\u0006","O0A0","M110A011","K11110A01111","J111C2C111","I111D2D111","I11B2222222B11","H11B22E22B11","H11B2B333B2B11","G000B2A34443A2B000","J222A34443A222","G000B2A34443A2B000","H11B2B333B2B11","H11B22E22B11","I11B2222222B11","I111D2D111","J111C2C111","K11110A01111","M110A011","O0A0",}, - {"\u0005","O0A0","L1110A0111","J111C2C111","I11E2E11","H11M11","H1O1","G11O11","G1Q1","G1Q1","F00Q00","H22M22","F00Q00","G1Q1","G1Q1","G11O11","H1O1","H11M11","I11E2E11","J111C2C111","L1110A0111","O0A0",}, - {"\u0004","O0A0","K11100000111","I111D2D111","H11F5F11","G11G5G11","G1Q1","F11Q11","F1S1","F1S1","F0S0","E00S00","F0255M5520","E00S00","F0S0","F1S1","F1S1","F11Q11","G1Q1","G11G5G11","H11F5F11","I111D2D111","K11100000111","O0A0",}, - {"\u0003","O0A0","J111110A011111","H111E2E111","G11D3335333D11","F11Q11","F1S1","E11S11","E1U1","E1U1","E1A3Q3A1","E1A3Q3A1","D00A3Q3A00","F25Q52","D00A3Q3A00","E1A3Q3A1","E1A3Q3A1","E1U1","E1U1","E11S11","F1S1","F11Q11","G11D3335333D11","H111E2E111","J111110A011111","O0A0",}, - {"\u0002","O0A0","K11100000111","H111E2E111","G11G5G11","F1S1","E11S11","E1U1","E1U1","D1W1","D1W1","D1W1","D0W0","C00W00","D025S520","C00W00","D0W0","D1W1","D1W1","D1W1","E1U1","E1U1","E11S11","F1S1","G11G5G11","H111E2E111","K11100000111","O0A0",}, - {"\u0001","O0A0","L1110A0111","I111D2D111","G11D3335333D11","F1S1","E1U1","E1U1","D1W1","D1W1","D1W1","C1Y1","C1A3U3A1","C1A3U3A1","B00A3U3A00","D25U52","B00A3U3A00","C1A3U3A1","C1A3U3A1","C1Y1","D1W1","D1W1","D1W1","E1U1","E1U1","F1S1","G11D3335333D11","I111D2D111","L1110A0111","O0A0",}, - {"\u0001","M110A011","J111C2C111","H11F5F11","F11Q11","E11S11","E1U1","D1W1","D1W1","C1Y1","C1Y1","C1Y1","B1[1","B1[1","B0[0","C25W52","B0[0","B1[1","B1[1","C1Y1","C1Y1","C1Y1","D1W1","D1W1","E1U1","E11S11","F11Q11","H11F5F11","J111C2C111","M110A011",}, - {E,"O0A0","K11110A01111","I11E2E11","G11G5G11","F1S1","E1U1","D1W1","D1W1","C1Y1","C1Y1","B1[1","B1[1","B1[1","B1[1","A00[00","C25W52","A00[00","B1[1","B1[1","B1[1","B1[1","C1Y1","C1Y1","D1W1","D1W1","E1U1","F1S1","G11G5G11","I11E2E11","K11110A01111","O0A0",}, - {E,"M110A011","J111C2C111","H11M11","G1Q1","E11S11","E1U1","D1W1","C1Y1","C1Y1","B1[1","B1[1","B1[1","A1]1","A1]1","A0]0","B2[2","A0]0","A1]1","A1]1","B1[1","B1[1","B1[1","C1Y1","C1Y1","D1W1","E1U1","E11S11","G1Q1","H11M11","J111C2C111","M110A011",}, - {E,"L1110A0111","I111D2D111","H1O1","F11Q11","E1U1","D1W1","D1W1","C1Y1","B1[1","B1[1","B1[1","A1]1","A1]1","A1]1","A0]0","B2[2","A0]0","A1]1","A1]1","A1]1","B1[1","B1[1","B1[1","C1Y1","D1W1","D1W1","E1U1","F11Q11","H1O1","I111D2D111","L1110A0111",}, - {"O0A0","K11110A01111","I11B2222222B11","G11O11","F1S1","E1U1","D1W1","C1Y1","C1Y1","B1[1","B1[1","A1]1","A1]1","A12[21","A12[21","002[200","B2[2","002[200","A12[21","A12[21","A1]1","A1]1","B1[1","B1[1","C1Y1","C1Y1","D1W1","E1U1","F1S1","G11O11","I11B2222222B11","K11110A01111","O0A0",}, - {"O0A0","J1111222221111","H11B22E22B11","G1Q1","F1S1","E1A3Q3A1","D1W1","C1A3U3A1","B1[1","B1[1","A1]1","A1]1","A12[21","A12[21","A2]2","02]20","A2]2","02]20","A2]2","A12[21","A12[21","A1]1","A1]1","B1[1","B1[1","C1A3U3A1","D1W1","E1A3Q3A1","F1S1","G1Q1","H11B22E22B11","J1111222221111","O0A0",}, - {"O0A0","J1112202022111","H11B2B333B2B11","G1Q1","F0S0","E1A3Q3A1","D0W0","C1A3U3A1","B1[1","B1[1","A1]1","A1]1","A12[21","A2]2","A2]2","003[300","A23[32","003[300","A2]2","A2]2","A12[21","A1]1","A1]1","B1[1","B1[1","C1A3U3A1","D0W0","E1A3Q3A1","F0S0","G1Q1","H11B2B333B2B11","J1112202022111","O0A0",}, - {"L000000000","I000020020020000","G000B2A34443A2B000","F00Q00","E00S00","D00A3Q3A00","C00W00","B00A3U3A00","B0[0","A00[00","A0]0","A0]0","002[200","02]20","003[300","004[400","024[420","004[400","003[300","02]20","002[200","A0]0","A0]0","A00[00","B0[0","B00A3U3A00","C00W00","D00A3Q3A00","E00S00","F00Q00","G000B2A34443A2B000","I000020020020000","L000000000",}, - {"O0A0","M2222222","J222A34443A222","H22M22","F0255M5520","F25Q52","D025S520","D25U52","C25W52","C25W52","B2[2","B2[2","B2[2","A2]2","A23[32","024[420","A24[42","024[420","A23[32","A2]2","B2[2","B2[2","B2[2","C25W52","C25W52","D25U52","D025S520","F25Q52","F0255M5520","H22M22","J222A34443A222","M2222222","O0A0",}, - {"L000000000","I000020020020000","G000B2A34443A2B000","F00Q00","E00S00","D00A3Q3A00","C00W00","B00A3U3A00","B0[0","A00[00","A0]0","A0]0","002[200","02]20","003[300","004[400","024[420","004[400","003[300","02]20","002[200","A0]0","A0]0","A00[00","B0[0","B00A3U3A00","C00W00","D00A3Q3A00","E00S00","F00Q00","G000B2A34443A2B000","I000020020020000","L000000000",}, - {"O0A0","J1112202022111","H11B2B333B2B11","G1Q1","F0S0","E1A3Q3A1","D0W0","C1A3U3A1","B1[1","B1[1","A1]1","A1]1","A12[21","A2]2","A2]2","003[300","A23[32","003[300","A2]2","A2]2","A12[21","A1]1","A1]1","B1[1","B1[1","C1A3U3A1","D0W0","E1A3Q3A1","F0S0","G1Q1","H11B2B333B2B11","J1112202022111","O0A0",}, - {"O0A0","J1111222221111","H11B22E22B11","G1Q1","F1S1","E1A3Q3A1","D1W1","C1A3U3A1","B1[1","B1[1","A1]1","A1]1","A12[21","A12[21","A2]2","02]20","A2]2","02]20","A2]2","A12[21","A12[21","A1]1","A1]1","B1[1","B1[1","C1A3U3A1","D1W1","E1A3Q3A1","F1S1","G1Q1","H11B22E22B11","J1111222221111","O0A0",}, - {"O0A0","K11110A01111","I11B2222222B11","G11O11","F1S1","E1U1","D1W1","C1Y1","C1Y1","B1[1","B1[1","A1]1","A1]1","A12[21","A12[21","002[200","B2[2","002[200","A12[21","A12[21","A1]1","A1]1","B1[1","B1[1","C1Y1","C1Y1","D1W1","E1U1","F1S1","G11O11","I11B2222222B11","K11110A01111","O0A0",}, - {E,"L1110A0111","I111D2D111","H1O1","F11Q11","E1U1","D1W1","D1W1","C1Y1","B1[1","B1[1","B1[1","A1]1","A1]1","A1]1","A0]0","B2[2","A0]0","A1]1","A1]1","A1]1","B1[1","B1[1","B1[1","C1Y1","D1W1","D1W1","E1U1","F11Q11","H1O1","I111D2D111","L1110A0111",}, - {E,"M110A011","J111C2C111","H11M11","G1Q1","E11S11","E1U1","D1W1","C1Y1","C1Y1","B1[1","B1[1","B1[1","A1]1","A1]1","A0]0","B2[2","A0]0","A1]1","A1]1","B1[1","B1[1","B1[1","C1Y1","C1Y1","D1W1","E1U1","E11S11","G1Q1","H11M11","J111C2C111","M110A011",}, - {E,"O0A0","K11110A01111","I11E2E11","G11G5G11","F1S1","E1U1","D1W1","D1W1","C1Y1","C1Y1","B1[1","B1[1","B1[1","B1[1","A00[00","C25W52","A00[00","B1[1","B1[1","B1[1","B1[1","C1Y1","C1Y1","D1W1","D1W1","E1U1","F1S1","G11G5G11","I11E2E11","K11110A01111","O0A0",}, - {"\u0001","M110A011","J111C2C111","H11F5F11","F11Q11","E11S11","E1U1","D1W1","D1W1","C1Y1","C1Y1","C1Y1","B1[1","B1[1","B0[0","C25W52","B0[0","B1[1","B1[1","C1Y1","C1Y1","C1Y1","D1W1","D1W1","E1U1","E11S11","F11Q11","H11F5F11","J111C2C111","M110A011",}, - {"\u0001","O0A0","L1110A0111","I111D2D111","G11D3335333D11","F1S1","E1U1","E1U1","D1W1","D1W1","D1W1","C1Y1","C1A3U3A1","C1A3U3A1","B00A3U3A00","D25U52","B00A3U3A00","C1A3U3A1","C1A3U3A1","C1Y1","D1W1","D1W1","D1W1","E1U1","E1U1","F1S1","G11D3335333D11","I111D2D111","L1110A0111","O0A0",}, - {"\u0002","O0A0","K11100000111","H111E2E111","G11G5G11","F1S1","E11S11","E1U1","E1U1","D1W1","D1W1","D1W1","D0W0","C00W00","D025S520","C00W00","D0W0","D1W1","D1W1","D1W1","E1U1","E1U1","E11S11","F1S1","G11G5G11","H111E2E111","K11100000111","O0A0",}, - {"\u0003","O0A0","J111110A011111","H111E2E111","G11D3335333D11","F11Q11","F1S1","E11S11","E1U1","E1U1","E1A3Q3A1","E1A3Q3A1","D00A3Q3A00","F25Q52","D00A3Q3A00","E1A3Q3A1","E1A3Q3A1","E1U1","E1U1","E11S11","F1S1","F11Q11","G11D3335333D11","H111E2E111","J111110A011111","O0A0",}, - {"\u0004","O0A0","K11100000111","I111D2D111","H11F5F11","G11G5G11","G1Q1","F11Q11","F1S1","F1S1","F0S0","E00S00","F0255M5520","E00S00","F0S0","F1S1","F1S1","F11Q11","G1Q1","G11G5G11","H11F5F11","I111D2D111","K11100000111","O0A0",}, - {"\u0005","O0A0","L1110A0111","J111C2C111","I11E2E11","H11M11","H1O1","G11O11","G1Q1","G1Q1","F00Q00","H22M22","F00Q00","G1Q1","G1Q1","G11O11","H1O1","H11M11","I11E2E11","J111C2C111","L1110A0111","O0A0",}, - {"\u0006","O0A0","M110A011","K11110A01111","J111C2C111","I111D2D111","I11B2222222B11","H11B22E22B11","H11B2B333B2B11","G000B2A34443A2B000","J222A34443A222","G000B2A34443A2B000","H11B2B333B2B11","H11B22E22B11","I11B2222222B11","I111D2D111","J111C2C111","K11110A01111","M110A011","O0A0",}, - {"\u0008","O0A0","M110A011","L1110A0111","K11110A01111","J1111222221111","J1112202022111","I000020020020000","M2222222","I000020020020000","J1112202022111","J1111222221111","K11110A01111","L1110A0111","M110A011","O0A0",}, - {"\u000B","O0A0","O0A0","O0A0","L000000000","O0A0","L000000000","O0A0","O0A0","O0A0",}, + {"\u000B", "M0000000", "L00 00", "L0 0", "L0 !!! 0", "L0 !.! 0", "L0 !!! 0", "L0 0", "L00 00", "M0000000",}, + {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, + {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, + {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, + {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, + {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, + {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, + {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, + {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, + {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, + {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, + {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, + {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, + {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, + {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, + {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, + {"O0A0", "M2222222", "J222A34443A222", "H22M22", "F0255M5520", "F25Q52", "D025S520", "D25U52", "C25W52", "C25W52", "B2[2", "B2[2", "B2[2", "A2]2", "A23[32", "024[420", "A24[42", "024[420", "A23[32", "A2]2", "B2[2", "B2[2", "B2[2", "C25W52", "C25W52", "D25U52", "D025S520", "F25Q52", "F0255M5520", "H22M22", "J222A34443A222", "M2222222", "O0A0",}, + {"L000000000", "I000020020020000", "G000B2A34443A2B000", "F00Q00", "E00S00", "D00A3Q3A00", "C00W00", "B00A3U3A00", "B0[0", "A00[00", "A0]0", "A0]0", "002[200", "02]20", "003[300", "004[400", "024[420", "004[400", "003[300", "02]20", "002[200", "A0]0", "A0]0", "A00[00", "B0[0", "B00A3U3A00", "C00W00", "D00A3Q3A00", "E00S00", "F00Q00", "G000B2A34443A2B000", "I000020020020000", "L000000000",}, + {"O0A0", "J1112202022111", "H11B2B333B2B11", "G1Q1", "F0S0", "E1A3Q3A1", "D0W0", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A2]2", "A2]2", "003[300", "A23[32", "003[300", "A2]2", "A2]2", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D0W0", "E1A3Q3A1", "F0S0", "G1Q1", "H11B2B333B2B11", "J1112202022111", "O0A0",}, + {"O0A0", "J1111222221111", "H11B22E22B11", "G1Q1", "F1S1", "E1A3Q3A1", "D1W1", "C1A3U3A1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "A2]2", "02]20", "A2]2", "02]20", "A2]2", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1A3U3A1", "D1W1", "E1A3Q3A1", "F1S1", "G1Q1", "H11B22E22B11", "J1111222221111", "O0A0",}, + {"O0A0", "K11110A01111", "I11B2222222B11", "G11O11", "F1S1", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "A1]1", "A1]1", "A12[21", "A12[21", "002[200", "B2[2", "002[200", "A12[21", "A12[21", "A1]1", "A1]1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "F1S1", "G11O11", "I11B2222222B11", "K11110A01111", "O0A0",}, + {E, "L1110A0111", "I111D2D111", "H1O1", "F11Q11", "E1U1", "D1W1", "D1W1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "D1W1", "D1W1", "E1U1", "F11Q11", "H1O1", "I111D2D111", "L1110A0111",}, + {E, "M110A011", "J111C2C111", "H11M11", "G1Q1", "E11S11", "E1U1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "A1]1", "A1]1", "A0]0", "B2[2", "A0]0", "A1]1", "A1]1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "E1U1", "E11S11", "G1Q1", "H11M11", "J111C2C111", "M110A011",}, + {E, "O0A0", "K11110A01111", "I11E2E11", "G11G5G11", "F1S1", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B1[1", "B1[1", "A00[00", "C25W52", "A00[00", "B1[1", "B1[1", "B1[1", "B1[1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "F1S1", "G11G5G11", "I11E2E11", "K11110A01111", "O0A0",}, + {"\u0001", "M110A011", "J111C2C111", "H11F5F11", "F11Q11", "E11S11", "E1U1", "D1W1", "D1W1", "C1Y1", "C1Y1", "C1Y1", "B1[1", "B1[1", "B0[0", "C25W52", "B0[0", "B1[1", "B1[1", "C1Y1", "C1Y1", "C1Y1", "D1W1", "D1W1", "E1U1", "E11S11", "F11Q11", "H11F5F11", "J111C2C111", "M110A011",}, + {"\u0001", "O0A0", "L1110A0111", "I111D2D111", "G11D3335333D11", "F1S1", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "C1Y1", "C1A3U3A1", "C1A3U3A1", "B00A3U3A00", "D25U52", "B00A3U3A00", "C1A3U3A1", "C1A3U3A1", "C1Y1", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "F1S1", "G11D3335333D11", "I111D2D111", "L1110A0111", "O0A0",}, + {"\u0002", "O0A0", "K11100000111", "H111E2E111", "G11G5G11", "F1S1", "E11S11", "E1U1", "E1U1", "D1W1", "D1W1", "D1W1", "D0W0", "C00W00", "D025S520", "C00W00", "D0W0", "D1W1", "D1W1", "D1W1", "E1U1", "E1U1", "E11S11", "F1S1", "G11G5G11", "H111E2E111", "K11100000111", "O0A0",}, + {"\u0003", "O0A0", "J111110A011111", "H111E2E111", "G11D3335333D11", "F11Q11", "F1S1", "E11S11", "E1U1", "E1U1", "E1A3Q3A1", "E1A3Q3A1", "D00A3Q3A00", "F25Q52", "D00A3Q3A00", "E1A3Q3A1", "E1A3Q3A1", "E1U1", "E1U1", "E11S11", "F1S1", "F11Q11", "G11D3335333D11", "H111E2E111", "J111110A011111", "O0A0",}, + {"\u0004", "O0A0", "K11100000111", "I111D2D111", "H11F5F11", "G11G5G11", "G1Q1", "F11Q11", "F1S1", "F1S1", "F0S0", "E00S00", "F0255M5520", "E00S00", "F0S0", "F1S1", "F1S1", "F11Q11", "G1Q1", "G11G5G11", "H11F5F11", "I111D2D111", "K11100000111", "O0A0",}, + {"\u0005", "O0A0", "L1110A0111", "J111C2C111", "I11E2E11", "H11M11", "H1O1", "G11O11", "G1Q1", "G1Q1", "F00Q00", "H22M22", "F00Q00", "G1Q1", "G1Q1", "G11O11", "H1O1", "H11M11", "I11E2E11", "J111C2C111", "L1110A0111", "O0A0",}, + {"\u0006", "O0A0", "M110A011", "K11110A01111", "J111C2C111", "I111D2D111", "I11B2222222B11", "H11B22E22B11", "H11B2B333B2B11", "G000B2A34443A2B000", "J222A34443A222", "G000B2A34443A2B000", "H11B2B333B2B11", "H11B22E22B11", "I11B2222222B11", "I111D2D111", "J111C2C111", "K11110A01111", "M110A011", "O0A0",}, + {"\u0008", "O0A0", "M110A011", "L1110A0111", "K11110A01111", "J1111222221111", "J1112202022111", "I000020020020000", "M2222222", "I000020020020000", "J1112202022111", "J1111222221111", "K11110A01111", "L1110A0111", "M110A011", "O0A0",}, + {"\u000B", "O0A0", "O0A0", "O0A0", "L000000000", "O0A0", "L000000000", "O0A0", "O0A0", "O0A0",}, }; - private static final Block[] blockType2 = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT,sBlockCasingsTT}; + private static final Block[] blockType2 = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta2 = new byte[]{12, 0, 13, 14, 10, 11}; //endregion @@ -140,66 +142,9 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E super(aName); } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_bhg(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if(structureCheck_EM(shape2, blockType2, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)){ - glassDome=true; - return true; - } - if(structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)){ - glassDome=false; - return true; - } - //todo check tiers of hatches!!!! - return false; - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - if((stackSize &1)==1) { - StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(),this, hintsOnly); - } else { - StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(),this, hintsOnly); - } - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Singularity based power generation.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" - }; - } - /** * Black hole event horizon radius calculator + * * @param massKg mass in kg * @return radius in meters */ @@ -209,6 +154,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole event horizon surface area calculator + * * @param massKg mass in kg * @return area in meters^2 */ @@ -218,6 +164,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole event horizon temperature calculator + * * @param massKg mass in kg * @return temperature in K */ @@ -227,6 +174,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole luminosity calculator + * * @param massKg mass in kg * @return luminosity in watts */ @@ -236,6 +184,7 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole acretion disk luminosity calculator + * * @param massKgPer1s mass injection kg per s * @return luminosity in watts */ @@ -245,36 +194,40 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole gravity field calculator, should be used for gravity blasting - * @param massKg mass in kg + * + * @param massKg mass in kg * @param distanceSq distance squared in meters * @return gravity field */ - private static double getGravityField(double massKg,double distanceSq) { + private static double getGravityField(double massKg, double distanceSq) { return massKg * 6.6743015e-11 / distanceSq; } /** * Black hole containment force calculator - * @param massKg mass in kg + * + * @param massKg mass in kg * @param radiusSq radius squared in meters * @return force in newtons */ - private static double getContainmentForce(double massKg,double radiusSq) { + private static double getContainmentForce(double massKg, double radiusSq) { return Math.pow(massKg, 2) * 6.6743015e-11 / radiusSq; } /** * Black hole containment pressure calculator F/s, should be used for bhg initial release explosion? - * @param massKg mass in kg + * + * @param massKg mass in kg * @param radiusSq radius squared in meters * @return pressure in pascals */ - private static double getContainmentPressure(double massKg,double radiusSq) { + private static double getContainmentPressure(double massKg, double radiusSq) { return getContainmentForce(massKg, radiusSq) / (12.566370614359172 * radiusSq); } /** * Black hole containment energy calculator, assuming F*s, and 100% efficient gravity force field + * * @param massKg mass in kg * @return power in watts */ @@ -284,16 +237,75 @@ public class GT_MetaTileEntity_EM_bhg extends GT_MetaTileEntity_MultiblockBase_E /** * Black hole power balance, zero at mass ~= 2.5525e10 (T~=4.8067e12) - * @param massKg mass in kg + * + * @param massKg mass in kg * @param massKgPer1s mass injection kg per s * @return power in watts */ @Deprecated - private static double getContainmentPowerBalance(double massKg,double massKgPer1s) { - return getLuminosity(massKg)+getAcretionDiskLuminosity(massKgPer1s)-getContainmentPower(massKg); + private static double getContainmentPowerBalance(double massKg, double massKgPer1s) { + return getLuminosity(massKg) + getAcretionDiskLuminosity(massKgPer1s) - getContainmentPower(massKg); } //todo compaction energy 8 * Long.MAx_VALUE? //todo neutronium decay gen? 0.0007186885 mass diff - actually compute hydrogen amount... -} + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_bhg(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + if (structureCheck_EM(shape2, blockType2, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + glassDome = true; + return true; + } + if (structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 16, 16, 0)) { + glassDome = false; + return true; + } + //todo check tiers of hatches!!!! + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Singularity based power generation.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Super unstable!!!" + }; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_BHG_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + if ((stackSize & 1) == 1) { + StructureBuilderExtreme(shape, blockType, blockMeta, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + } else { + StructureBuilderExtreme(shape2, blockType2, blockMeta2, 16, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } +}
\ No newline at end of file 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 5d3a700153..8e0cf294f3 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 @@ -15,11 +15,7 @@ import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.casing.TT_Container_Casings; import com.github.technus.tectech.thing.metaTileEntity.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; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -48,6 +44,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; private static Textures.BlockIcons.CustomIcon ScreenON_Slave; @@ -57,12 +54,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static double MASS_TO_EU_INSTANT; private static int STARTUP_COST, KEEPUP_COST; - public static void setValues(int heliumPlasmaValue) { - double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff - MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; - STARTUP_COST = -heliumPlasmaValue * 10000; - KEEPUP_COST = -heliumPlasmaValue; - } + protected byte eTier = 0; + protected cElementalInstanceStack stack; + private long plasmaEnergy; + + protected boolean started = false; + //endregion //region collision handlers public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS = new HashMap<>(); @@ -266,10 +263,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } //endregion - protected byte eTier = 0; - protected cElementalInstanceStack stack; - private long plasmaEnergy; - //region parameters protected Parameters.Group.ParameterIn mode; private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p) -> { @@ -300,9 +293,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }; //endregion - protected boolean started = false; - - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {"I0A0A0", "I00000", "I0A0A0",}, @@ -363,59 +354,98 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB super(aName); } - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); + public static void setValues(int heliumPlasmaValue) { + double MASS_TO_EU_PARTIAL = heliumPlasmaValue / 1.75893000478707E07;//mass diff + MASS_TO_EU_INSTANT = MASS_TO_EU_PARTIAL * 20; + STARTUP_COST = -heliumPlasmaValue * 10000; + KEEPUP_COST = -heliumPlasmaValue; } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(mName); - } + protected double fuse(GT_MetaTileEntity_EM_collider partner) { + if (partner.stack != null && stack != null) {//todo add single event mode as an option + boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && + partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); - ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); - ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); - super.registerIcons(aBlockIconRegister); - } + cElementalInstanceStack stack2 = partner.stack; + double preMass = stack2.getMass() + stack.getMass(); + //System.out.println("preMass = " + preMass); - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - if (aFacing % 2 == 0) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + cElementalInstanceStackMap map = new cElementalInstanceStackMap(); + IColliderHandler colliderHandler; + if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first + colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; } else { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); + if (handleRecipe(stack2, map, colliderHandler)) return 0; + } + for (cElementalInstanceStack newStack : map.values()) { + check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); } + //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); + outputEM = new cElementalInstanceStackMap[]{map}; + + partner.stack = stack = null; + //System.out.println("check = " + check); + //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); + return check ? preMass - map.getMass() : + Math.min(preMass - map.getMass(), 0); } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + return 0; } - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setByte("eTier", eTier);//collider tier - aNBT.setBoolean("eStarted", started); - if (stack != null) { - aNBT.setTag("eStack", stack.toNBT()); + private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { + if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { + colliderHandler.collide(stack2, stack, map); + } else { + map.putUnifyAll(stack, stack2); + outputEM = new cElementalInstanceStackMap[]{map}; + return true; } - aNBT.setLong("ePlasmaEnergy", plasmaEnergy); + return false; } - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - eTier = aNBT.getByte("eTier");//collider tier - started = aNBT.getBoolean("eStarted"); - if (aNBT.hasKey("eStack")) { - stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); + protected GT_MetaTileEntity_EM_collider getPartner() { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); + if (gregTechBaseTileEntity != null) { + IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); + return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && + ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && + gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? + (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; } - plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); + return null; + } + + protected final boolean isMaster() { + return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; + } + + private void makeEU(double massDiff) { + plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; + System.out.println("plasmaEnergy = " + plasmaEnergy); + } + + private cElementalInstanceStackMap tickStack() { + if (stack == null) { + return null; + } + cElementalInstanceStackMap newInstances = stack.decay(1, stack.age += 1, 0); + if (newInstances == null) { + stack.nextColor(); + } else { + stack = newInstances.remove(newInstances.getLast().definition); + } + return newInstances; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_collider(mName); } @Override @@ -456,37 +486,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } @Override - public void construct(int stackSize, boolean hintsOnly) { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - if (hintsOnly) { - TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), - iGregTechTileEntity.getXCoord() + xDir, - iGregTechTileEntity.getYCoord() + yDir, - iGregTechTileEntity.getZCoord() + zDir, - TT_Container_Casings.sHintCasingsTT, 12); - } else { - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { - 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, this, hintsOnly); - } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); - } - } - - @Override - public void parametersStatusesWrite_EM(boolean machineBusy) { - if (isMaster()) { - super.parametersStatusesWrite_EM(machineBusy); - } - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { GT_MetaTileEntity_EM_collider partner = getPartner(); if (partner == null) { @@ -528,99 +527,6 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } } - protected double fuse(GT_MetaTileEntity_EM_collider partner) { - if (partner.stack != null && stack != null) {//todo add single event mode as an option - boolean check = stack.definition.fusionMakesEnergy(stack.getEnergy()) && - partner.stack.definition.fusionMakesEnergy(partner.stack.getEnergy()); - - cElementalInstanceStack stack2 = partner.stack; - double preMass = stack2.getMass() + stack.getMass(); - //System.out.println("preMass = " + preMass); - - cElementalInstanceStackMap map = new cElementalInstanceStackMap(); - IColliderHandler colliderHandler; - if (stack2.definition.getClassType() > stack.definition.getClassType()) {//always bigger first - colliderHandler = FUSE_HANDLERS.get((stack2.definition.getClassType() << 16) | stack.definition.getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } else { - colliderHandler = FUSE_HANDLERS.get((stack.definition.getClassType() << 16) | stack2.definition.getClassType()); - if (handleRecipe(stack2, map, colliderHandler)) return 0; - } - for (cElementalInstanceStack newStack : map.values()) { - check &= newStack.definition.fusionMakesEnergy(newStack.getEnergy()); - } - //System.out.println("outputEM[0].getMass() = " + outputEM[0].getMass()); - outputEM = new cElementalInstanceStackMap[]{map}; - - partner.stack = stack = null; - //System.out.println("check = " + check); - //System.out.println("preMass-map.getMass() = " + (preMass - map.getMass())); - return check ? preMass - map.getMass() : - Math.min(preMass - map.getMass(), 0); - } - return 0; - } - - private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { - colliderHandler.collide(stack2, stack, map); - } else { - map.putUnifyAll(stack, stack2); - outputEM = new cElementalInstanceStackMap[]{map}; - return true; - } - return false; - } - - @Override - protected void afterRecipeCheckFailed() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - getBaseMetaTileEntity().disableWorking(); - super.afterRecipeCheckFailed(); - } - - @Override - public void stopMachine() { - started = false; - if (stack != null) { - cleanMassEM_EM(stack.getMass()); - stack = null; - } - super.stopMachine(); - } - - @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (!aBaseMetaTileEntity.isAllowedToWork()) { - started = false; - } - super.onPreTick(aBaseMetaTileEntity, aTick); - } - - protected GT_MetaTileEntity_EM_collider getPartner() { - IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; - int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; - IGregTechTileEntity gregTechBaseTileEntity = iGregTechTileEntity.getIGregTechTileEntityOffset(xDir, yDir, zDir); - if (gregTechBaseTileEntity != null) { - IMetaTileEntity gregTechMetaTileEntity = gregTechBaseTileEntity.getMetaTileEntity(); - return gregTechMetaTileEntity instanceof GT_MetaTileEntity_EM_collider && - ((GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity).mMachine && - gregTechBaseTileEntity.getBackFacing() == iGregTechTileEntity.getFrontFacing() ? - (GT_MetaTileEntity_EM_collider) gregTechMetaTileEntity : null; - } - return null; - } - - protected final boolean isMaster() { - return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; - } - @Override public void outputAfterRecipe_EM() { GT_MetaTileEntity_EM_collider partner = getPartner(); @@ -663,35 +569,127 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } } - private void makeEU(double massDiff) { - plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; - System.out.println("plasmaEnergy = " + plasmaEnergy); + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Collide matter at extreme velocities.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light*!!!" + }; } - private cElementalInstanceStackMap tickStack() { - if (stack == null) { - return null; + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE"); + ScreenOFF_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_SLAVE"); + ScreenON_Slave = new Textures.BlockIcons.CustomIcon("iconsets/EM_COLLIDER_ACTIVE_SLAVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aFacing % 2 == 0) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } else { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; + } } - cElementalInstanceStackMap newInstances = stack.decay(1, stack.age += 1, 0); - if (newInstances == null) { - stack.nextColor(); - } else { - stack = newInstances.remove(newInstances.getLast().definition); + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0); + mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); + } + + @Override + public void parametersStatusesWrite_EM(boolean machineBusy) { + if (isMaster()) { + super.parametersStatusesWrite_EM(machineBusy); } - return newInstances; } @Override - public String[] getStructureDescription(int stackSize) { - return description; + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setByte("eTier", eTier);//collider tier + aNBT.setBoolean("eStarted", started); + if (stack != null) { + aNBT.setTag("eStack", stack.toNBT()); + } + aNBT.setLong("ePlasmaEnergy", plasmaEnergy); } @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Collide matter at extreme velocities.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light*!!!" - }; + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + eTier = aNBT.getByte("eTier");//collider tier + started = aNBT.getBoolean("eStarted"); + if (aNBT.hasKey("eStack")) { + stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); + } + plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); + } + + @Override + public void stopMachine() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + super.stopMachine(); + } + + @Override + protected void afterRecipeCheckFailed() { + started = false; + if (stack != null) { + cleanMassEM_EM(stack.getMass()); + stack = null; + } + getBaseMetaTileEntity().disableWorking(); + super.afterRecipeCheckFailed(); + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (!aBaseMetaTileEntity.isAllowedToWork()) { + started = false; + } + super.onPreTick(aBaseMetaTileEntity, aTick); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + IGregTechTileEntity iGregTechTileEntity = getBaseMetaTileEntity(); + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 4; + int yDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetY * 4; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 4; + if (hintsOnly) { + TecTech.proxy.hint_particle(iGregTechTileEntity.getWorld(), + iGregTechTileEntity.getXCoord() + xDir, + iGregTechTileEntity.getYCoord() + yDir, + iGregTechTileEntity.getZCoord() + zDir, + TT_Container_Casings.sHintCasingsTT, 12); + } else { + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir).getMaterial() == Material.air) { + 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, this, hintsOnly); + } else { + StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); + } + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; } }
\ No newline at end of file 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 1aa2420773..ee21f81e06 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 @@ -40,12 +40,14 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private final ArrayList<GT_MetaTileEntity_Hatch_Rack> eRacks = new ArrayList<>(); private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //endregion - //region Structure + //region structure private static final String[][] front = new String[][]{{"A ", "A ", "A. ", "A ",},}; private static final String[][] terminator = new String[][]{{"A ", "A ", "A ", "A ",},}; private static final String[][] cap = new String[][]{{"-01", "A22", "A22", "-01",},}; @@ -101,39 +103,48 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0); - overclock = hatch_0.makeInParameter(0, 1, OC_NAME, OC_STATUS); - overvolt = hatch_0.makeInParameter(1, 1, OV_NAME, OV_STATUS); - maxCurrentTemp = hatch_0.makeOutParameter(0, 0, MAX_TEMP_NAME, MAX_TEMP_STATUS); - availableData = hatch_0.makeOutParameter(1, 0, COMPUTE_NAME, COMPUTE_STATUS); - } - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_switch.activitySound; - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_computer(mName); } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + rack.getBaseMetaTileEntity().setActive(false); + } } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; + eRacks.clear(); + if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { + return false; + } + if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { + return false; + } + byte offset = -2, totalLen = 4; + while (offset > -16) { + if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { + break; + } + totalLen++; + offset--; + } + if (totalLen > 16) { + return false; + } + if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + return false; + } + if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + return false; + } + eCertainMode = (byte) Math.min(totalLen / 3, 5); + for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); + } + } + return eUncertainHatches.size() == 1; } @Override @@ -226,21 +237,37 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - protected long getAvailableData_EM() { - return eAvailableData; + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + Util.intBitsToString(TecTech.RANDOM.nextInt()), + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.computer.desc")//You need it to process the number above + }; } @Override - protected void afterRecipeCheckFailed() { - super.afterRecipeCheckFailed(); - for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { - rack.getBaseMetaTileEntity().setActive(false); - } + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_COMPUTER_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; + } + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return GT_MetaTileEntity_EM_switch.activitySound; } - @Override//Had a crash bug with breaking a rack and then the multi + @Override public void onRemoval() { super.onRemoval(); for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { @@ -251,6 +278,27 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0); + overclock = hatch_0.makeInParameter(0, 1, OC_NAME, OC_STATUS); + overvolt = hatch_0.makeInParameter(1, 1, OV_NAME, OV_STATUS); + maxCurrentTemp = hatch_0.makeOutParameter(0, 0, MAX_TEMP_NAME, MAX_TEMP_STATUS); + availableData = hatch_0.makeOutParameter(1, 0, COMPUTE_NAME, COMPUTE_STATUS); + } + + @Override + protected void extraExplosions_EM() { + for (MetaTileEntity tTileEntity : eRacks) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + } + } + + @Override + protected long getAvailableData_EM() { + return eAvailableData; + } + + @Override public void stopMachine() { super.stopMachine(); eAvailableData = 0; @@ -262,43 +310,28 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB } @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + protected void afterRecipeCheckFailed() { + super.afterRecipeCheckFailed(); for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { rack.getBaseMetaTileEntity().setActive(false); } } - eRacks.clear(); - if (!structureCheck_EM(front, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0)) { - return false; - } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, -1)) { - return false; - } - byte offset = -2, totalLen = 4; - while (offset > -16) { - if (!structureCheck_EM(slice, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, offset)) { - break; - } - totalLen++; - offset--; - } - if (totalLen > 16) { - return false; - } - if (!structureCheck_EM(cap, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, ++offset)) { + } + + public final boolean addRackToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { return false; } - if (!structureCheck_EM(terminator, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, --offset)) { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { return false; } - eCertainMode = (byte) Math.min(totalLen / 3, 5); - for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { - rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); - } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Rack) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return eRacks.add((GT_MetaTileEntity_Hatch_Rack) aMetaTileEntity); } - return eUncertainHatches.size() == 1; + return false; } @Override @@ -320,36 +353,4 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB public String[] getStructureDescription(int stackSize) { return description; } - - @Override - protected void extraExplosions_EM() { - for (MetaTileEntity tTileEntity : eRacks) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - } - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - Util.intBitsToString(TecTech.RANDOM.nextInt()), - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.computer.desc")//You need it to process the number above - }; - } - - //NEW METHOD - public final boolean addRackToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - if (aTileEntity == null) { - return false; - } - IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Rack) { - ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return eRacks.add((GT_MetaTileEntity_Hatch_Rack) aMetaTileEntity); - } - return false; - } }
\ No newline at end of file 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 a72740e84f..8e55ba4988 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 @@ -26,32 +26,35 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public static final String crafter="EM Crafting"; + public static final String crafter = "EM Crafting"; + //endregion + //region structure private static final String[][] shape = new String[][]{ - {"A000","0 0","0 . 0","0 0","A000",}, - {"00000","00000","00000","00000","00000",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"22222","22222","22122","22222","22222",}, - {"23432","33333","43134","33333","23432",}, - {"23332","33333","33533","33333","23332",}, - {"23432","33333","43134","33333","23432",}, - {"22222","22222","22122","22222","22222",}, - {"0C0","A!!!","A!1!","A!!!","0C0",}, - {"00000","00000","00000","00000","00000",}, - {"A000","0 0","0 0","0 0","A000",}, + {"A000", "0 0", "0 . 0", "0 0", "A000",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, + {"22222", "22222", "22122", "22222", "22222",}, + {"23432", "33333", "43134", "33333", "23432",}, + {"23332", "33333", "33533", "33333", "23332",}, + {"23432", "33333", "43134", "33333", "23432",}, + {"22222", "22222", "22122", "22222", "22222",}, + {"0C0", "A!!!", "A!1!", "A!!!", "0C0",}, + {"00000", "00000", "00000", "00000", "00000",}, + {"A000", "0 0", "0 0", "0 0", "A000",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT , QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 10, 5, 0, 6, 9}; private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", "2 - Elemental Hatches or Molecular Casing", }; @@ -71,6 +74,11 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); + } + + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_CRAFTING"); @@ -79,6 +87,15 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "The most precise way of making stuff.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" + }; + } + + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; @@ -87,26 +104,12 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB } @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); - } - - @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),this,hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override public String[] getStructureDescription(int stackSize) { return description; } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "The most precise way of making stuff.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "(Trans-Planck process)" - }; - } -} +}
\ No newline at end of file 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 b05653fb33..f18fe57b6f 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 @@ -36,10 +36,12 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private final ArrayList<GT_MetaTileEntity_Hatch_OutputDataItems> eStacksDataOutputs = new ArrayList<>(); private final ArrayList<GT_MetaTileEntity_Hatch_DataAccess> eDataAccessHatches = new ArrayList<>(); + //endregion - //region Structure + //region structure private static final String[][] shape = new String[][]{ {"0 0", "0 . 0", "0 0",}, {"0!!!0", "01110", "0!!!0",}, @@ -66,38 +68,12 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB super(aName); } - public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_hi_freq"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return activitySound; - } - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_dataBank(mName); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { eDataAccessHatches.clear(); eStacksDataOutputs.clear(); @@ -105,16 +81,6 @@ 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(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) { mEUt = -(int) V[4]; @@ -159,7 +125,32 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB }; } - //NEW METHOD + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true);//todo texture + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; + } + + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_hi_freq"); + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return activitySound; + } + public final boolean addDataBankHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; @@ -177,4 +168,14 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB } return false; } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 21344b9f34..f650d550c5 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 @@ -6,11 +6,7 @@ import com.github.technus.tectech.mechanics.elementalMatter.core.stacks.cElement import com.github.technus.tectech.thing.metaTileEntity.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.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import com.github.technus.tectech.thing.metaTileEntity.multi.base.render.TT_RenderedTexture; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -39,22 +35,13 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; public static final double URANIUM_INGOT_MASS_DIFF = 1.6114516E10; private static final double URANIUM_MASS_TO_EU_PARTIAL = ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear") * 3_000_000.0 / URANIUM_INGOT_MASS_DIFF; public static final double URANIUM_MASS_TO_EU_INSTANT = URANIUM_MASS_TO_EU_PARTIAL *20; - - //region parameters - protected Parameters.Group.ParameterIn ampereFlow; - private static final INameFunction<GT_MetaTileEntity_EM_decay> FLOW_NAME= (base, p)->"Ampere divider"; - private static final IStatusFunction<GT_MetaTileEntity_EM_decay> FLOW_STATUS= (base, p)->{ - if(base.eAmpereFlow<=0){ - return STATUS_TOO_LOW; - } - return STATUS_OK; - }; //endregion //region structure @@ -82,6 +69,17 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase }; //endregion + //region parameters + protected Parameters.Group.ParameterIn ampereFlow; + private static final INameFunction<GT_MetaTileEntity_EM_decay> FLOW_NAME= (base, p)->"Ampere divider"; + private static final IStatusFunction<GT_MetaTileEntity_EM_decay> FLOW_STATUS= (base, p)->{ + if(base.eAmpereFlow<=0){ + return STATUS_TOO_LOW; + } + return STATUS_OK; + }; + //endregion + public GT_MetaTileEntity_EM_decay(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); } @@ -91,57 +89,16 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0=parametrization.getGroup(0, true); - ampereFlow=hatch_0.makeInParameter(0,1,FLOW_NAME,FLOW_STATUS); - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_decay(mName); } @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Is life time too long?", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make it half-life (3) instead!" - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { cElementalInstanceStackMap map= getInputsClone_EM(); if(map!=null && map.hasStacks()){ @@ -164,7 +121,7 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase for(cElementalInstanceStack stack:outputEM[0].values()){ if (stack.getEnergy() == 0 && stack.definition.decayMakesEnergy(1) && getBaseMetaTileEntity().decreaseStoredEnergyUnits( - (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { + (long) (stack.getEnergySettingCost(1) * URANIUM_MASS_TO_EU_INSTANT), false)) { stack.setEnergy(1); }else if(!stack.definition.decayMakesEnergy(stack.getEnergy())){ outputEM[0].remove(stack.definition); @@ -194,6 +151,15 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase } @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Is life time too long?", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Make it half-life (3) instead!" + }; + } + + @Override public String[] getInfoData() {//TODO Do it long storedEnergy = 0; long maxEnergy = 0; @@ -229,4 +195,36 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase "Computation: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, }; } -} + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/EM_DECAY_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][12]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0=parametrization.getGroup(0, true); + ampereFlow=hatch_0.makeInParameter(0,1,FLOW_NAME,FLOW_STATUS); + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),this,hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } +}
\ No newline at end of file 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 e682c77702..27b770c88b 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 @@ -37,8 +37,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, @@ -71,10 +70,17 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return GT_MetaTileEntity_EM_quantizer.activitySound; + private void startRecipe(iHasElementalDefinition from, long energy) { + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + float mass = from.getMass(); + float euMult = Math.abs(mass / refMass); + eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); + if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { + mEUt = (int) -V[8]; + } else { + mEUt = (int) -V[6]; + } } @Override @@ -88,16 +94,6 @@ 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(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { cElementalInstanceStackMap map = in.getContainerHandler(); @@ -136,19 +132,6 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo return false; } - private void startRecipe(iHasElementalDefinition from, long energy) { - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - float mass = from.getMass(); - float euMult = Math.abs(mass / refMass); - eAmpereFlow = (int) Math.ceil(Math.sqrt(Math.sqrt(euMult))); - if (mass > refUnstableMass || from.getDefinition().getRawTimeSpan(energy) < STABLE_RAW_LIFE_TIME) { - mEUt = (int) -V[8]; - } else { - mEUt = (int) -V[6]; - } - } - @Override public String[] getDescription() { return new String[]{ @@ -157,4 +140,20 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.desc.1")//regular one, but why? }; } + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return GT_MetaTileEntity_EM_quantizer.activitySound; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 d0b5b4ff35..71be7013be 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 @@ -32,7 +32,7 @@ import static gregtech.api.GregTech_API.mEUtoRF; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region Structure + //region structure private static final String[][] shape = new String[][]{ {" ", "000", "1.1", "000", " ",}, {" ", "010", "111", "010", " ",}, @@ -45,7 +45,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", }; //endregion @@ -53,22 +53,55 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa public GT_MetaTileEntity_EM_infuser(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); minRepairStatus = (byte) getIdealStatus(); - eDismantleBoom=true; + eDismantleBoom = true; } public GT_MetaTileEntity_EM_infuser(String aName) { super(aName); minRepairStatus = (byte) getIdealStatus(); - eDismantleBoom=true; + eDismantleBoom = true; } + private long doChargeItemStack(IElectricItem item, ItemStack stack) { + try { + double euDiff = item.getMaxCharge(stack) - ElectricItem.manager.getCharge(stack); + if (euDiff > 0) { + setEUVar(getEUVar() - (getEUVar() >> 5)); + } + long remove = (long) Math.ceil( + ElectricItem.manager.charge(stack, + Math.min(euDiff, getEUVar()) + , item.getTier(stack), true, false)); + setEUVar(getEUVar() - remove); + if (getEUVar() < 0) { + setEUVar(0); + } + return remove; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + return 0; + } - public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_whooum"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ - return activitySound; + private long doChargeItemStackRF(IEnergyContainerItem item, ItemStack stack) { + try { + long RF = Math.min(item.getMaxEnergyStored(stack) - item.getEnergyStored(stack), getEUVar() * mEUtoRF / 100L); + //if(RF>0)this.setEUVar(this.getEUVar()-this.getEUVar()>>10); + RF = item.receiveEnergy(stack, RF > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) RF, false); + RF = RF * 100L / mEUtoRF; + setEUVar(getEUVar() - RF); + if (getEUVar() < 0) { + setEUVar(0); + } + return RF; + } catch (Exception e) { + if (DEBUG_MODE) { + e.printStackTrace(); + } + } + return 0; } @Override @@ -77,31 +110,11 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa } @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity,true,false,true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true,false,true); - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 2, 0); } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,1, 2, 0, getBaseMetaTileEntity(),this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { if (itemStack != null && itemStack.stackSize == 1) { Item ofThis = itemStack.getItem(); @@ -149,45 +162,31 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa }; } - private long doChargeItemStack(IElectricItem item, ItemStack stack) { - try { - double euDiff = item.getMaxCharge(stack) - ElectricItem.manager.getCharge(stack); - if (euDiff > 0) { - setEUVar(getEUVar() - (getEUVar() >> 5)); - } - long remove = (long) Math.ceil( - ElectricItem.manager.charge(stack, - Math.min(euDiff, getEUVar()) - , item.getTier(stack), true, false)); - setEUVar(getEUVar() - remove); - if (getEUVar() < 0) { - setEUVar(0); - } - return remove; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - return 0; + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, true, false, true); } - private long doChargeItemStackRF(IEnergyContainerItem item, ItemStack stack) { - try { - long RF = Math.min(item.getMaxEnergyStored(stack) - item.getEnergyStored(stack), getEUVar() * mEUtoRF / 100L); - //if(RF>0)this.setEUVar(this.getEUVar()-this.getEUVar()>>10); - RF = item.receiveEnergy(stack, RF > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) RF, false); - RF = RF * 100L / mEUtoRF; - setEUVar(getEUVar() - RF); - if (getEUVar() < 0) { - setEUVar(0); - } - return RF; - } catch (Exception e) { - if (DEBUG_MODE) { - e.printStackTrace(); - } - } - return 0; + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", true, false, true); + } + + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_whooum"); + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return activitySound; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; } -} +}
\ No newline at end of file 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 9d431e3bc3..aba87eaf6b 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 @@ -4,11 +4,7 @@ import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.thing.metaTileEntity.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.GT_MetaTileEntity_MultiblockBase_EM; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IHatchAdder; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; @@ -28,7 +24,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, @@ -95,17 +91,6 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } @Override - protected void parametersInstantiation_EM() { - src = new Parameters.Group.ParameterIn[10]; - dst = new Parameters.Group.ParameterIn[10]; - for (int i = 0; i < 10; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - src[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); - dst[i] = hatch.makeInParameter(1, i, ROUTE_NAME, DST_STATUS); - } - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_junction(mName); } @@ -122,25 +107,6 @@ 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(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.junction.desc.0"),//Reroutes Matter - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.junction.desc.1")//Axis aligned movement! - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) { if (in.getContainerHandler().hasStacks()) { @@ -181,4 +147,34 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } } } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.junction.desc.0"),//Reroutes Matter + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.junction.desc.1")//Axis aligned movement! + }; + } + + @Override + protected void parametersInstantiation_EM() { + src = new Parameters.Group.ParameterIn[10]; + dst = new Parameters.Group.ParameterIn[10]; + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + src[i] = hatch.makeInParameter(0, i, ROUTE_NAME, SRC_STATUS); + dst[i] = hatch.makeInParameter(1, i, ROUTE_NAME, DST_STATUS); + } + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 ee327bed51..4d65b67ed0 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 @@ -46,7 +46,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, @@ -79,14 +79,6 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock super(aName); } - public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_mid_freq"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return activitySound; - } - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_quantizer(mName); @@ -98,25 +90,6 @@ 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(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.0"),//Conveniently convert regular stuff into quantum form. - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.1")//To make it more inconvenient. - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) {//TODO implement instance quantization if (GregTech_API.sPostloadFinished) { ArrayList<ItemStack> storedInputs = getStoredInputs(); @@ -205,4 +178,31 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); outputEM = null; } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.0"),//Conveniently convert regular stuff into quantum form. + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.desc.1")//To make it more inconvenient. + }; + } + + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_mid_freq"); + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return activitySound; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 0a2e06ac7d..0690a30b8b 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 @@ -48,12 +48,14 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private final ArrayList<GT_MetaTileEntity_Hatch_Holder> eHolders = new ArrayList<>(); private GT_Recipe.GT_Recipe_AssemblyLine tRecipe; private TT_recipe.TT_assLineRecipe aRecipe; private String machineType; private ItemStack holdItem; - private long computationRemaining,computationRequired; + private long computationRemaining, computationRequired; + //endregion //region structure private static final String[][] shape = new String[][]{ @@ -72,7 +74,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, Blocks.air}; private static final byte[] blockMetaFallback = new byte[]{1, 0}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+translateToLocal("tt.keyphrase.Hint_Details") + ":", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic/Data Hatches or Computer casing", "2 - Holder Hatch", }; @@ -86,183 +88,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB super(aName); } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_research(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { - rack.getBaseMetaTileEntity().setActive(false); - } - } - eHolders.clear(); - - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { - return false; - } - - for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { - rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); - } - } - return eHolders.size() == 1; - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,1, 3, 4, getBaseMetaTileEntity(),this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setLong("eComputationRemaining",computationRemaining); - aNBT.setLong("eComputationRequired",computationRequired); - if(holdItem!=null) { - aNBT.setTag("eHold", holdItem.writeToNBT(new NBTTagCompound())); - } else { - aNBT.removeTag("eHold"); - } - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - computationRemaining=aNBT.getLong("eComputationRemaining"); - computationRequired=aNBT.getLong("eComputationRequired"); - if(aNBT.hasKey("eHold")) { - holdItem = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("eHold")); - } else { - holdItem = null; - } - } - - @Override - public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { - if(aBaseMetaTileEntity.isServerSide()) { - if (computationRemaining > 0) { - aRecipe = null; - tRecipe = null; - if (holdItem != null) { - if (ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { - for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, holdItem, true)) { - this.tRecipe = tRecipe; - break; - } - } - } else if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sMachineRecipes.recipeList()) { - if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - aRecipe = assRecipeTT; - machineType = machine; - break; - } - } - if (aRecipe == null) { - for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()) { - if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - aRecipe = assRecipeTT; - machineType = crafter; - break; - } - } - } - } - } - if (tRecipe == null && aRecipe == null) { - holdItem = null; - computationRequired = computationRemaining = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { - r.getBaseMetaTileEntity().setActive(false); - } - } - } - } - } - - @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - tRecipe=null; - aRecipe=null; - if(!eHolders.isEmpty() && eHolders.get(0).mInventory[0]!=null) { - holdItem = eHolders.get(0).mInventory[0].copy(); - if(ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { - for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { - if (GT_Utility.areStacksEqual(assRecipe.mResearchItem, holdItem, true)) { - tRecipe = assRecipe; - //if found - if (iterateRecipes()) return true; - } - } - }else if(ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)){ - for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sMachineRecipes.recipeList()){ - if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - aRecipe = assRecipeTT; - machineType=machine; - //if found - if (iterateRecipes()) return true; - } - } - for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()){ - if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - aRecipe = assRecipeTT; - machineType=crafter; - //if found - if (iterateRecipes()) return true; - } - } - } - } - holdItem=null; - computationRequired=computationRemaining=0; - for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { - r.getBaseMetaTileEntity().setActive(false); - } - return false; - } - - private boolean iterateRecipes() { - for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { - if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], holdItem, true)) { - computationRequired = computationRemaining = ttRecipe.mDuration * 20L; - mMaxProgresstime = 20; - mEfficiencyIncrease = 10000; - eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); - eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); - mEUt = ttRecipe.mEUt; - eHolders.get(0).getBaseMetaTileEntity().setActive(true); - return true; - } - } - return false; - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if(computationRemaining<=0) { - computationRemaining=0; - mProgresstime=mMaxProgresstime; - return true; - }else{ - computationRemaining-=eAvailableData; - mProgresstime=1; - return super.onRunningTick(aStack); - } - } - - private void makeStick(){ + private void makeStick() { mInventory[1].setTagCompound(new NBTTagCompound()); mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + " Construction Data"); GT_Utility.ItemNBT.setBookTitle(mInventory[1], GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + " Construction Data"); @@ -294,36 +120,37 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } private static LinkedHashMap<String, String> lServerNames; + static { try { Class GT_Assemblyline_Server = Class.forName("gregtech.api.util.GT_Assemblyline_Server"); - lServerNames=(LinkedHashMap<String, String>)GT_Assemblyline_Server.getField("lServerNames").get(null); - }catch (ClassNotFoundException|NoSuchFieldException|IllegalAccessException e){ - lServerNames=null; + lServerNames = (LinkedHashMap<String, String>) GT_Assemblyline_Server.getField("lServerNames").get(null); + } catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) { + lServerNames = null; } } - private void makeStick2(){ + private void makeStick2() { String s = tRecipe.mOutput.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s==null) { + if (s == null) { s = tRecipe.mOutput.getDisplayName(); } } mInventory[1].setTagCompound(new NBTTagCompound()); - mInventory[1].setStackDisplayName(s+" Construction Data"); - GT_Utility.ItemNBT.setBookTitle(mInventory[1], s+" Construction Data"); + mInventory[1].setStackDisplayName(s + " Construction Data"); + GT_Utility.ItemNBT.setBookTitle(mInventory[1], s + " Construction Data"); NBTTagCompound tNBT = mInventory[1].getTagCompound(); tNBT.setTag("output", tRecipe.mOutput.writeToNBT(new NBTTagCompound())); tNBT.setInteger("time", tRecipe.mDuration); tNBT.setInteger("eu", tRecipe.mEUt); - for(int i = 0 ; i < tRecipe.mInputs.length ; i++){ - tNBT.setTag(""+i, tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < tRecipe.mInputs.length; i++) { + tNBT.setTag("" + i, tRecipe.mInputs[i].writeToNBT(new NBTTagCompound())); } - for(int i = 0 ; i < tRecipe.mOreDictAlt.length ; i++){ + for (int i = 0; i < tRecipe.mOreDictAlt.length; i++) { if (tRecipe.mOreDictAlt[i] != null && tRecipe.mOreDictAlt[i].length > 0) { tNBT.setInteger("a" + i, tRecipe.mOreDictAlt[i].length); for (int j = 0; j < tRecipe.mOreDictAlt[i].length; j++) { @@ -331,30 +158,30 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } } } - for(int i = 0 ; i < tRecipe.mFluidInputs.length ; i++){ - tNBT.setTag("f"+i, tRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { + tNBT.setTag("f" + i, tRecipe.mFluidInputs[i].writeToNBT(new NBTTagCompound())); } - tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType+ " Recipe Generator"); + tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " Recipe Generator"); NBTTagList tNBTList = new NBTTagList(); - s=tRecipe.mOutput.getDisplayName(); + s = tRecipe.mOutput.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { s = lServerNames.get(tRecipe.mOutput.getDisplayName()); - if (s==null) { + if (s == null) { s = tRecipe.mOutput.getDisplayName(); } } - tNBTList.appendTag(new NBTTagString("Construction plan for "+tRecipe.mOutput.stackSize+" "+s+". Needed EU/t: "+tRecipe.mEUt+" Production time: "+(tRecipe.mDuration/20))); - for(int i=0;i<tRecipe.mInputs.length;i++){ + tNBTList.appendTag(new NBTTagString("Construction plan for " + tRecipe.mOutput.stackSize + " " + s + ". Needed EU/t: " + tRecipe.mEUt + " Production time: " + (tRecipe.mDuration / 20))); + for (int i = 0; i < tRecipe.mInputs.length; i++) { if (tRecipe.mOreDictAlt[i] != null) { int count = 0; - StringBuilder tBuilder = new StringBuilder("Input Bus "+(i+1)+": "); + StringBuilder tBuilder = new StringBuilder("Input Bus " + (i + 1) + ": "); for (ItemStack tStack : tRecipe.mOreDictAlt[i]) { if (tStack != null) { - s=tStack.getDisplayName(); + s = tStack.getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { - s=lServerNames.get(tStack.getDisplayName()); - if (s==null) - s=tStack.getDisplayName(); + s = lServerNames.get(tStack.getDisplayName()); + if (s == null) + s = tStack.getDisplayName(); } @@ -363,27 +190,27 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } } if (count > 0) tNBTList.appendTag(new NBTTagString(tBuilder.toString())); - } else if(tRecipe.mInputs[i]!=null){ - s=tRecipe.mInputs[i].getDisplayName(); + } else if (tRecipe.mInputs[i] != null) { + s = tRecipe.mInputs[i].getDisplayName(); if (getBaseMetaTileEntity().isServerSide()) { s = lServerNames.get(tRecipe.mInputs[i].getDisplayName()); - if (s==null) { + if (s == null) { s = tRecipe.mInputs[i].getDisplayName(); } } - tNBTList.appendTag(new NBTTagString("Input Bus "+(i+1)+": "+tRecipe.mInputs[i].stackSize+" "+s)); + tNBTList.appendTag(new NBTTagString("Input Bus " + (i + 1) + ": " + tRecipe.mInputs[i].stackSize + " " + s)); } } - for(int i=0;i<tRecipe.mFluidInputs.length;i++){ - if(tRecipe.mFluidInputs[i]!=null){ - s=tRecipe.mFluidInputs[i].getLocalizedName(); + for (int i = 0; i < tRecipe.mFluidInputs.length; i++) { + if (tRecipe.mFluidInputs[i] != null) { + s = tRecipe.mFluidInputs[i].getLocalizedName(); if (getBaseMetaTileEntity().isServerSide()) { s = lServerNames.get(tRecipe.mFluidInputs[i].getLocalizedName()); - if (s==null) { + if (s == null) { s = tRecipe.mFluidInputs[i].getLocalizedName(); } } - tNBTList.appendTag(new NBTTagString("Input Hatch "+(i+1)+": "+tRecipe.mFluidInputs[i].amount+"L "+s)); + tNBTList.appendTag(new NBTTagString("Input Hatch " + (i + 1) + ": " + tRecipe.mFluidInputs[i].amount + "L " + s)); } } tNBT.setTag("pages", tNBTList); @@ -391,10 +218,93 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB mInventory[1].setTagCompound(tNBT); } + private boolean iterateRecipes() { + for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { + if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], holdItem, true)) { + computationRequired = computationRemaining = ttRecipe.mDuration * 20L; + mMaxProgresstime = 20; + mEfficiencyIncrease = 10000; + eRequiredData = (short) (ttRecipe.mSpecialValue >>> 16); + eAmpereFlow = (short) (ttRecipe.mSpecialValue & 0xFFFF); + mEUt = ttRecipe.mEUt; + eHolders.get(0).getBaseMetaTileEntity().setActive(true); + return true; + } + } + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_research(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + rack.getBaseMetaTileEntity().setActive(false); + } + } + eHolders.clear(); + + if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 3, 4)) { + return false; + } + + for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) { + rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); + } + } + return eHolders.size() == 1; + } + + @Override + public boolean checkRecipe_EM(ItemStack itemStack) { + tRecipe = null; + aRecipe = null; + if (!eHolders.isEmpty() && eHolders.get(0).mInventory[0] != null) { + holdItem = eHolders.get(0).mInventory[0].copy(); + if (ItemList.Tool_DataStick.isStackEqual(itemStack, false, true)) { + for (GT_Recipe.GT_Recipe_AssemblyLine assRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + if (GT_Utility.areStacksEqual(assRecipe.mResearchItem, holdItem, true)) { + tRecipe = assRecipe; + //if found + if (iterateRecipes()) return true; + } + } + } else if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { + for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sMachineRecipes.recipeList()) { + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { + aRecipe = assRecipeTT; + machineType = machine; + //if found + if (iterateRecipes()) return true; + } + } + for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()) { + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { + aRecipe = assRecipeTT; + machineType = crafter; + //if found + if (iterateRecipes()) return true; + } + } + } + } + holdItem = null; + computationRequired = computationRemaining = 0; + for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { + r.getBaseMetaTileEntity().setActive(false); + } + return false; + } + @Override public void outputAfterRecipe_EM() { - if(!eHolders.isEmpty()) { - if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)){ + if (!eHolders.isEmpty()) { + if (tRecipe != null && ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { eHolders.get(0).getBaseMetaTileEntity().setActive(false); eHolders.get(0).mInventory[0] = null; if (lServerNames == null) { @@ -402,40 +312,74 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } else { try { makeStick2(); - }catch (NoSuchFieldError e){ + } catch (NoSuchFieldError e) { makeStick(); } } - }else if (aRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { + } else if (aRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { eHolders.get(0).getBaseMetaTileEntity().setActive(false); eHolders.get(0).mInventory[0] = null; - mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(aRecipe.mOutputs[0].getDisplayName()) + ' ' + machineType +" Construction Data"); + mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(aRecipe.mOutputs[0].getDisplayName()) + ' ' + machineType + " Construction Data"); NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null tNBT.setString("eMachineType", machineType); - GameRegistry.UniqueIdentifier uid=GameRegistry.findUniqueIdentifierFor(aRecipe.mOutputs[0].getItem()); - tNBT.setString(E_RECIPE_ID, uid+":"+aRecipe.mOutputs[0].getItemDamage()); - tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType+ " Recipe Generator"); + GameRegistry.UniqueIdentifier uid = GameRegistry.findUniqueIdentifierFor(aRecipe.mOutputs[0].getItem()); + tNBT.setString(E_RECIPE_ID, uid + ":" + aRecipe.mOutputs[0].getItemDamage()); + tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " Recipe Generator"); } } - computationRequired=computationRemaining=0; - tRecipe=null; - aRecipe=null; - holdItem=null; + computationRequired = computationRemaining = 0; + tRecipe = null; + aRecipe = null; + holdItem = null; } @Override - protected void extraExplosions_EM() { - for (MetaTileEntity tTileEntity : eHolders) { - tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); - } + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "Philosophers didn't even...", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "dream about it!" + }; } - //@Override - //public boolean isFacingValid(byte aFacing) { - // return aFacing >= 2; - //} + @Override + public String[] getInfoData() { + long storedEnergy = 0; + long maxEnergy = 0; + for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + + return new String[]{ + "Energy Hatches:", + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", + "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + + " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", + "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + + " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, + "Computation Available: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET, + "Computation Remaining:", + EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + + EnumChatFormatting.YELLOW + computationRequired / 20L + }; + } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { @@ -446,16 +390,6 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "Philosophers didn't even...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "dream about it!" - }; - } - - - @Override public void onRemoval() { super.onRemoval(); for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { @@ -464,18 +398,112 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override + protected void extraExplosions_EM() { + for (MetaTileEntity tTileEntity : eHolders) { + tTileEntity.getBaseMetaTileEntity().doExplosion(V[9]); + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setLong("eComputationRemaining", computationRemaining); + aNBT.setLong("eComputationRequired", computationRequired); + if (holdItem != null) { + aNBT.setTag("eHold", holdItem.writeToNBT(new NBTTagCompound())); + } else { + aNBT.removeTag("eHold"); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + computationRemaining = aNBT.getLong("eComputationRemaining"); + computationRequired = aNBT.getLong("eComputationRequired"); + if (aNBT.hasKey("eHold")) { + holdItem = ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("eHold")); + } else { + holdItem = null; + } + } + + @Override public void stopMachine() { super.stopMachine(); for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { r.getBaseMetaTileEntity().setActive(false); } - computationRequired=computationRemaining=0; - tRecipe=null; - aRecipe=null; - holdItem=null; + computationRequired = computationRemaining = 0; + tRecipe = null; + aRecipe = null; + holdItem = null; + } + + //@Override + //public boolean isFacingValid(byte aFacing) { + // return aFacing >= 2; + //} + + @Override + public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + if (aBaseMetaTileEntity.isServerSide()) { + if (computationRemaining > 0) { + aRecipe = null; + tRecipe = null; + if (holdItem != null) { + if (ItemList.Tool_DataStick.isStackEqual(mInventory[1], false, true)) { + for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { + if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, holdItem, true)) { + this.tRecipe = tRecipe; + break; + } + } + } else if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { + for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sMachineRecipes.recipeList()) { + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { + aRecipe = assRecipeTT; + machineType = machine; + break; + } + } + if (aRecipe == null) { + for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()) { + if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { + aRecipe = assRecipeTT; + machineType = crafter; + break; + } + } + } + } + } + if (tRecipe == null && aRecipe == null) { + holdItem = null; + computationRequired = computationRemaining = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + for (GT_MetaTileEntity_Hatch_Holder r : eHolders) { + r.getBaseMetaTileEntity().setActive(false); + } + } + } + } + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (computationRemaining <= 0) { + computationRemaining = 0; + mProgresstime = mMaxProgresstime; + return true; + } else { + computationRemaining -= eAvailableData; + mProgresstime = 1; + return super.onRunningTick(aStack); + } } - //NEW METHOD public final boolean addHolderToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { if (aTileEntity == null) { return false; @@ -497,39 +525,12 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } @Override - public String[] getInfoData() { - long storedEnergy = 0; - long maxEnergy = 0; - for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { - storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 3, 4, getBaseMetaTileEntity(), this, hintsOnly); + } - return new String[]{ - "Energy Hatches:", - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", - (mEUt <= 0 ? "Probably uses: " : "Probably makes: ") + - EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", - "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + - " Amp Rating: " + EnumChatFormatting.GREEN + eMaxAmpereFlow + EnumChatFormatting.RESET + " A", - "Problems: " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + - " Efficiency: " + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", - "PowerPass: " + EnumChatFormatting.BLUE + ePowerPass + EnumChatFormatting.RESET + - " SafeVoid: " + EnumChatFormatting.BLUE + eSafeVoid, - "Computation Available: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET, - "Computation Remaining:", - EnumChatFormatting.GREEN + Long.toString(computationRemaining / 20L) + EnumChatFormatting.RESET + " / " + - EnumChatFormatting.YELLOW + computationRequired / 20L - }; + @Override + public String[] getStructureDescription(int stackSize) { + return description; } -} +}
\ No newline at end of file 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 a7f4c84f41..20ba5eb57f 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 @@ -13,12 +13,7 @@ import com.github.technus.tectech.thing.block.QuantumStuffBlock; import com.github.technus.tectech.thing.item.ElementalDefinitionScanStorage_EM; import com.github.technus.tectech.thing.metaTileEntity.IConstructable; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_EnergyMulti; -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.LedStatus; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.Parameters; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.INameFunction; -import com.github.technus.tectech.thing.metaTileEntity.multi.base.IStatusFunction; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.*; import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -51,6 +46,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables public static final int SCAN_DO_NOTHING = 0, SCAN_GET_NOMENCLATURE = 1, SCAN_GET_DEPTH_LEVEL = 2, SCAN_GET_AMOUNT = 4, SCAN_GET_CHARGE = 8, SCAN_GET_MASS = 16, SCAN_GET_ENERGY_LEVEL = 32, SCAN_GET_TIMESPAN_INFO = 64, SCAN_GET_ENERGY_STATES = 128, @@ -62,23 +58,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private String machineType; private long totalComputationRemaining, totalComputationRequired; private int[] scanComplexity; - - //region parameters - private static final INameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME = - (base, p) -> "Config at Depth: " + (p.hatchId() * 2 + p.parameterId()); - private static final IStatusFunction<GT_MetaTileEntity_EM_scanner> CONFIG_STATUS = - (base, p) -> { - double v = p.get(); - if (Double.isNaN(v)) { - return LedStatus.STATUS_WRONG; - } - v = (int) v; - if (v == 0) return LedStatus.STATUS_NEUTRAL; - if (v >= SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; - if (v < 0) return LedStatus.STATUS_TOO_LOW; - return LedStatus.STATUS_OK; - }; - protected Parameters.Group.ParameterIn[] scanConfiguration; //endregion //region structure @@ -111,6 +90,24 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa }; //endregion + //region parameters + private static final INameFunction<GT_MetaTileEntity_EM_scanner> CONFIG_NAME = + (base, p) -> "Config at Depth: " + (p.hatchId() * 2 + p.parameterId()); + private static final IStatusFunction<GT_MetaTileEntity_EM_scanner> CONFIG_STATUS = + (base, p) -> { + double v = p.get(); + if (Double.isNaN(v)) { + return LedStatus.STATUS_WRONG; + } + v = (int) v; + if (v == 0) return LedStatus.STATUS_NEUTRAL; + if (v >= SCAN_GET_CLASS_TYPE) return LedStatus.STATUS_TOO_HIGH; + if (v < 0) return LedStatus.STATUS_TOO_LOW; + return LedStatus.STATUS_OK; + }; + protected Parameters.Group.ParameterIn[] scanConfiguration; + //endregion + public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); eDismantleBoom = true; @@ -121,135 +118,93 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa eDismantleBoom = true; } - @Override - protected void parametersInstantiation_EM() { - scanConfiguration = new Parameters.Group.ParameterIn[20]; - for (int i = 0; i < 10; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - scanConfiguration[i * 2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); - scanConfiguration[i * 2 + 1] = hatch.makeInParameter(1, 0, CONFIG_NAME, CONFIG_STATUS); + private void quantumStuff(boolean shouldExist) { + IGregTechTileEntity base = getBaseMetaTileEntity(); + if (base != null && base.getWorld() != null) { + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); + Block block = base.getWorld().getBlock(xDir, yDir, zDir); + if (shouldExist) { + if (block != null && block.getMaterial() == Material.air) { + base.getWorld().setBlock(xDir, yDir, zDir, QuantumStuffBlock.INSTANCE, 0, 2); + } + } else { + if (block instanceof QuantumStuffBlock) { + base.getWorld().setBlock(xDir, yDir, zDir, Blocks.air, 0, 2); + } + } } } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_scanner(mName); - } + private void addComputationRequirements(int depthPlus, int capabilities) { + if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) { + totalComputationRequired += depthPlus * 5L; + eRequiredData += depthPlus; + } + if (areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { + totalComputationRequired += depthPlus * 10L; + eRequiredData += depthPlus; - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { - return false; } - return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); - } + if (areBitsSet(SCAN_GET_AMOUNT, capabilities)) { + totalComputationRequired += depthPlus * 64L; + eRequiredData += depthPlus * 8L; - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); - } + } + if (areBitsSet(SCAN_GET_CHARGE, capabilities)) { + totalComputationRequired += depthPlus * 128L; + eRequiredData += depthPlus * 4L; - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } + } + if (areBitsSet(SCAN_GET_MASS, capabilities)) { + totalComputationRequired += depthPlus * 256L; + eRequiredData += depthPlus * 4L; - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "",//What is existing here? - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + ""//I HAVE NO IDEA (yet)! - }; - } + } + if (areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { + totalComputationRequired += depthPlus * 512L; + eRequiredData += depthPlus * 16L; - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setLong("eComputationRemaining", totalComputationRemaining); - aNBT.setLong("eComputationRequired", totalComputationRequired); - if (objectResearched != null) { - aNBT.setTag("eObject", objectResearched.toNBT()); - } else { - aNBT.removeTag("eObject"); } - if (scanComplexity != null) { - aNBT.setIntArray("eScanComplexity", scanComplexity); - } else { - aNBT.removeTag("eScanComplexity"); + if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { + totalComputationRequired += depthPlus * 1024L; + eRequiredData += depthPlus * 32L; + } - if (objectsScanned != null) { - aNBT.setTag("eScanObjects", objectsScanned.toNBT()); - } else { - aNBT.removeTag("eScanObjects"); + if (areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { + totalComputationRequired += depthPlus * 2048L; + eRequiredData += depthPlus * 32L; + } - } + if (areBitsSet(SCAN_GET_COLOR, capabilities)) { + totalComputationRequired += depthPlus * 1024L; + eRequiredData += depthPlus * 48L; - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - totalComputationRemaining = aNBT.getLong("eComputationRemaining"); - totalComputationRequired = aNBT.getLong("eComputationRequired"); - if (aNBT.hasKey("eObject")) { - objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); - if (objectResearched.definition == nbtE__) { - objectResearched = null; - } - } else { - objectResearched = null; } - if (aNBT.hasKey("eScanComplexity")) { - scanComplexity = aNBT.getIntArray("eScanComplexity"); - } else { - scanComplexity = null; + if (areBitsSet(SCAN_GET_AGE, capabilities)) { + totalComputationRequired += depthPlus * 2048L; + eRequiredData += depthPlus * 64L; + } - try { - if (aNBT.hasKey("eScanObjects")) { - objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); - } - } catch (tElementalException e) { - objectsScanned = new cElementalInstanceStackMap(); + if (areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { + totalComputationRequired += depthPlus * 2048L; + eRequiredData += depthPlus * 64L; + } } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isActive() && (aTick & 0x2) == 0 && aBaseMetaTileEntity.isClientSide()) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4 + aBaseMetaTileEntity.getXCoord(); - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY * 4 + aBaseMetaTileEntity.getYCoord(); - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4 + aBaseMetaTileEntity.getZCoord(); - aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir, yDir, zDir, xDir, yDir, zDir); - } + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_scanner(mName); } @Override - public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { - if (aBaseMetaTileEntity.isServerSide()) { - if (totalComputationRemaining > 0 && objectResearched != null) { - eRecipe = null; - if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition); - if (eRecipe != null) { - machineType = machine; - } else { - eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); - if (eRecipe != null) { - machineType = crafter; - } - } - } - if (eRecipe == null) { - quantumStuff(false); - objectResearched = null; - eRequiredData = 0; - totalComputationRequired = totalComputationRemaining = 0; - mMaxProgresstime = 0; - mEfficiencyIncrease = 0; - } else { - quantumStuff(true); - } - } + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + if (!structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0)) { + return false; } + return eInputHatches.size() == 1 && eOutputHatches.size() == 1 && eOutputHatches.get(0).getBaseMetaTileEntity().getFrontFacing() == iGregTechTileEntity.getFrontFacing(); } @Override @@ -338,76 +293,6 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa return false; } - private void addComputationRequirements(int depthPlus, int capabilities) { - if (areBitsSet(SCAN_GET_NOMENCLATURE, capabilities)) { - totalComputationRequired += depthPlus * 5L; - eRequiredData += depthPlus; - } - if (areBitsSet(SCAN_GET_DEPTH_LEVEL, capabilities)) { - totalComputationRequired += depthPlus * 10L; - eRequiredData += depthPlus; - - } - if (areBitsSet(SCAN_GET_AMOUNT, capabilities)) { - totalComputationRequired += depthPlus * 64L; - eRequiredData += depthPlus * 8L; - - } - if (areBitsSet(SCAN_GET_CHARGE, capabilities)) { - totalComputationRequired += depthPlus * 128L; - eRequiredData += depthPlus * 4L; - - } - if (areBitsSet(SCAN_GET_MASS, capabilities)) { - totalComputationRequired += depthPlus * 256L; - eRequiredData += depthPlus * 4L; - - } - if (areBitsSet(SCAN_GET_ENERGY_LEVEL, capabilities)) { - totalComputationRequired += depthPlus * 512L; - eRequiredData += depthPlus * 16L; - - } - if (areBitsSet(SCAN_GET_TIMESPAN_INFO, capabilities)) { - totalComputationRequired += depthPlus * 1024L; - eRequiredData += depthPlus * 32L; - - } - if (areBitsSet(SCAN_GET_ENERGY_STATES, capabilities)) { - totalComputationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 32L; - - } - if (areBitsSet(SCAN_GET_COLOR, capabilities)) { - totalComputationRequired += depthPlus * 1024L; - eRequiredData += depthPlus * 48L; - - } - if (areBitsSet(SCAN_GET_AGE, capabilities)) { - totalComputationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 64L; - - } - if (areBitsSet(SCAN_GET_TIMESPAN_MULT, capabilities)) { - totalComputationRequired += depthPlus * 2048L; - eRequiredData += depthPlus * 64L; - - } - } - - @Override - public boolean onRunningTick(ItemStack aStack) { - if (totalComputationRemaining <= 0) { - totalComputationRemaining = 0; - mProgresstime = mMaxProgresstime; - return true; - } else { - totalComputationRemaining -= eAvailableData; - mProgresstime = 1; - return super.onRunningTick(aStack); - } - } - @Override public void outputAfterRecipe_EM() { if (eRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { @@ -427,8 +312,12 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override - public int getInventoryStackLimit() { - return 1; + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "",//What is existing here? + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + ""//I HAVE NO IDEA (yet)! + }; } @Override @@ -475,6 +364,65 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } @Override + protected void parametersInstantiation_EM() { + scanConfiguration = new Parameters.Group.ParameterIn[20]; + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + scanConfiguration[i * 2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); + scanConfiguration[i * 2 + 1] = hatch.makeInParameter(1, 0, CONFIG_NAME, CONFIG_STATUS); + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setLong("eComputationRemaining", totalComputationRemaining); + aNBT.setLong("eComputationRequired", totalComputationRequired); + if (objectResearched != null) { + aNBT.setTag("eObject", objectResearched.toNBT()); + } else { + aNBT.removeTag("eObject"); + } + if (scanComplexity != null) { + aNBT.setIntArray("eScanComplexity", scanComplexity); + } else { + aNBT.removeTag("eScanComplexity"); + } + if (objectsScanned != null) { + aNBT.setTag("eScanObjects", objectsScanned.toNBT()); + } else { + aNBT.removeTag("eScanObjects"); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + totalComputationRemaining = aNBT.getLong("eComputationRemaining"); + totalComputationRequired = aNBT.getLong("eComputationRequired"); + if (aNBT.hasKey("eObject")) { + objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); + if (objectResearched.definition == nbtE__) { + objectResearched = null; + } + } else { + objectResearched = null; + } + if (aNBT.hasKey("eScanComplexity")) { + scanComplexity = aNBT.getIntArray("eScanComplexity"); + } else { + scanComplexity = null; + } + try { + if (aNBT.hasKey("eScanObjects")) { + objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); + } + } catch (tElementalException e) { + objectsScanned = new cElementalInstanceStackMap(); + } + } + + @Override public void stopMachine() { quantumStuff(false); super.stopMachine(); @@ -483,22 +431,71 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } - private void quantumStuff(boolean shouldExist) { - IGregTechTileEntity base = getBaseMetaTileEntity(); - if (base != null && base.getWorld() != null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 4 + base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 4 + base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 4 + base.getZCoord(); - Block block = base.getWorld().getBlock(xDir, yDir, zDir); - if (shouldExist) { - if (block != null && block.getMaterial() == Material.air) { - base.getWorld().setBlock(xDir, yDir, zDir, QuantumStuffBlock.INSTANCE, 0, 2); + @Override + public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + if (aBaseMetaTileEntity.isServerSide()) { + if (totalComputationRemaining > 0 && objectResearched != null) { + eRecipe = null; + if (ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { + eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(objectResearched.definition); + if (eRecipe != null) { + machineType = machine; + } else { + eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(objectResearched.definition); + if (eRecipe != null) { + machineType = crafter; + } + } } - } else { - if (block instanceof QuantumStuffBlock) { - base.getWorld().setBlock(xDir, yDir, zDir, Blocks.air, 0, 2); + if (eRecipe == null) { + quantumStuff(false); + objectResearched = null; + eRequiredData = 0; + totalComputationRequired = totalComputationRemaining = 0; + mMaxProgresstime = 0; + mEfficiencyIncrease = 0; + } else { + quantumStuff(true); } } } } + + @Override + public boolean onRunningTick(ItemStack aStack) { + if (totalComputationRemaining <= 0) { + totalComputationRemaining = 0; + mProgresstime = mMaxProgresstime; + return true; + } else { + totalComputationRemaining -= eAvailableData; + mProgresstime = 1; + return super.onRunningTick(aStack); + } + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isActive() && (aTick & 0x2) == 0 && aBaseMetaTileEntity.isClientSide()) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 4 + aBaseMetaTileEntity.getXCoord(); + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY * 4 + aBaseMetaTileEntity.getYCoord(); + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 4 + aBaseMetaTileEntity.getZCoord(); + aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir, yDir, zDir, xDir, yDir, zDir); + } + } + + @Override + public int getInventoryStackLimit() { + return 1; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 30794ca47e..a51e8a781f 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 @@ -21,20 +21,20 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { //region structure private static final String[][] shape = new String[][]{ - {"A010","0 0","1 . 1","0 0","A010",}, - {"23232","32223","22222","32223","23232",}, - {"12!21","22422","!444!","22422","12!21",}, - {"23232","32223","22222","32223","23232",}, - {"A010","0 0","1 1","0 0","A010",}, + {"A010", "0 0", "1 . 1", "0 0", "A010",}, + {"23232", "32223", "22222", "32223", "23232",}, + {"12!21", "22422", "!444!", "22422", "12!21",}, + {"23232", "32223", "22222", "32223", "23232",}, + {"A010", "0 0", "1 1", "0 0", "A010",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT ,sBlockCasingsTT, sBlockCasingsTT}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{4, 0, 5, 6, 9}; private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", "2 - Elemental Hatches or Molecular Casing", }; @@ -59,16 +59,6 @@ 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(),this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, @@ -76,4 +66,14 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Wibbly wobbly timey wimey, stuff." }; } -} + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } +}
\ No newline at end of file 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 933e266781..795349c50c 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 @@ -32,7 +32,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region Structure + //region structure private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, {" ", " 0 ", " ",}, @@ -87,53 +87,16 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas } @Override - protected void parametersInstantiation_EM() { - dst = new Parameters.Group.ParameterIn[10]; - weight = new Parameters.Group.ParameterIn[10]; - for (int i = 0; i < 10; i++) { - Parameters.Group hatch = parametrization.getGroup(i); - dst[i] = hatch.makeInParameter(0, i, ROUTE_NAME, DST_STATUS); - weight[i] = hatch.makeInParameter(1, 0, ROUTE_NAME, WEI_STATUS); - } - } - - public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_hi_freq"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return activitySound; - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_switch(mName); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { short thingsActive = 0; for (GT_MetaTileEntity_Hatch_InputData di : eInputData) { @@ -224,4 +187,41 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.switch.desc.1")//Quality of service is a must }; } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; + } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; + } + + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_hi_freq"); + + @Override + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return activitySound; + } + + @Override + protected void parametersInstantiation_EM() { + dst = new Parameters.Group.ParameterIn[10]; + weight = new Parameters.Group.ParameterIn[10]; + for (int i = 0; i < 10; i++) { + Parameters.Group hatch = parametrization.getGroup(i); + dst[i] = hatch.makeInParameter(0, i, ROUTE_NAME, DST_STATUS); + weight[i] = hatch.makeInParameter(1, 0, ROUTE_NAME, WEI_STATUS); + } + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 f02b41d9ce..1a3bebf59b 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 @@ -31,7 +31,7 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - //region Structure + //region structure private static final String[][] shape = new String[][]{ {" ", " . ", " ",}, {" ", " 0 ", " ",}, @@ -71,14 +71,6 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo eDismantleBoom = true; } - public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_noise"); - - @Override - @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound() { - return activitySound; - } - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_EM_transformer(mName); @@ -90,8 +82,27 @@ 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(), this, hintsOnly); + public boolean checkRecipe_EM(ItemStack itemStack) { + if (ePowerPass) { + mEfficiencyIncrease = 10000; + mMaxProgresstime = 20; + } else { + mEfficiencyIncrease = 0; + mMaxProgresstime = 0; + } + eAmpereFlow = 0; + mEUt = 0; + return ePowerPass; + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_GENERAL, + translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.0"),//Power substation + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.1"),//All the transformation! + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.2"),//Only 0.78125% power loss, HAYO! + }; } @Override @@ -105,11 +116,6 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new TT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; @@ -117,32 +123,21 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0]}; } + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_noise"); + @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_GENERAL, - translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.0"),//Power substation - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.1"),//All the transformation! - EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.em.transformer.desc.2"),//Only 0.78125% power loss, HAYO! - }; + @SideOnly(Side.CLIENT) + protected ResourceLocation getActivitySound() { + return activitySound; } @Override - public boolean checkRecipe_EM(ItemStack itemStack) { - if (ePowerPass) { - mEfficiencyIncrease = 10000; - mMaxProgresstime = 20; - } else { - mEfficiencyIncrease = 0; - mMaxProgresstime = 0; - } - eAmpereFlow = 0; - mEUt = 0; - return ePowerPass; + public boolean onRunningTick(ItemStack aStack) { + return true; } @Override - public boolean onRunningTick(ItemStack aStack) { + public boolean doRandomMaintenanceDamage() { return true; } @@ -154,7 +149,12 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo } @Override - public boolean doRandomMaintenanceDamage() { - return true; + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; } }
\ No newline at end of file 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 7f69f459f9..20d20921d4 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 @@ -27,31 +27,33 @@ import static gregtech.api.enums.GT_Values.E; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable {//TODO MAKE COMPATIBLE WITH STARGATES XD + //region variables private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; + //endregion //region structure private static final String[][] shape = new String[][]{ - {E,E,E,"C ","C . ","C "/*,E,E,E,*/}, - {E,E,"D0","C000","B00100","C000","D0"/*,E,E,*/}, - {E,E,"D0","C2A2","B0C0","C2A2","D0"/*,E,E,*/}, - {E,"D0","D0",E,"A00C00",E,"D0","D0"/*,E,*/}, - {E,"D0",E,E,"A0E0",E,E,"D0"/*,E,*/}, - {"D0","D0",E,E,"00E00",E,E,"D0","D0",}, - {"B00000","A0033300","003C300","03E30","03E30","03E30","003C300","A0033300","B00000",}, - {"B0!!!0","A 31113 ","031222130","!12C21!","!12C21!","!12C21!","031222130","A 31113 ","B0!!!0",}, - {"B0!!!0","A 31113 ","031444130","!14C41!","!14C41!","!14C41!","031444130","A 31113 ","B0!!!0",}, - {"B0!!!0","A 31113 ","031222130","!12C21!","!12C21!","!12C21!","031222130","A 31113 ","B0!!!0",}, - {"B00000","A0033300","003C300","03E30","03E30","03E30","003C300","A0033300","B00000",}, + {E, E, E, "C ", "C . ", "C "/*,E,E,E,*/}, + {E, E, "D0", "C000", "B00100", "C000", "D0"/*,E,E,*/}, + {E, E, "D0", "C2A2", "B0C0", "C2A2", "D0"/*,E,E,*/}, + {E, "D0", "D0", E, "A00C00", E, "D0", "D0"/*,E,*/}, + {E, "D0", E, E, "A0E0", E, E, "D0"/*,E,*/}, + {"D0", "D0", E, E, "00E00", E, E, "D0", "D0",}, + {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, + {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, + {"B0!!!0", "A 31113 ", "031444130", "!14C41!", "!14C41!", "!14C41!", "031444130", "A 31113 ", "B0!!!0",}, + {"B0!!!0", "A 31113 ", "031222130", "!12C21!", "!12C21!", "!12C21!", "031222130", "A 31113 ", "B0!!!0",}, + {"B00000", "A0033300", "003C300", "03E30", "03E30", "03E30", "003C300", "A0033300", "B00000",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE ,sBlockCasingsTT, sBlockCasingsTT}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT, QuantumGlassBlock.INSTANCE, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMeta = new byte[]{12, 10, 0, 5, 11}; private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addElementalToMachineList}; private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 4}; private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + "Hint Details:", "1 - Classic Hatches or High Power Casing", "2 - Elemental Hatches or Molecular Casing", }; @@ -71,6 +73,20 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB } @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); + } + + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.TEC_MARK_EM, + "It is not full of worms.", + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "It is full of anti-worms!!!" + }; + } + + @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister aBlockIconRegister) { ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/EM_WH"); @@ -87,26 +103,12 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB } @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 4, 4, 0); - } - - @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,4, 4, 0, getBaseMetaTileEntity(),this,hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 4, 4, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override public String[] getStructureDescription(int stackSize) { return description; } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.TEC_MARK_EM, - "It is not full of worms.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "It is full of anti-worms!!!" - }; - } -} +}
\ No newline at end of file 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 6d9691ba10..60a642ee95 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 @@ -34,9 +34,11 @@ import static net.minecraft.util.StatCollector.translateToLocal; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private boolean hasBeenPausedThisCycle = false; + //endregion - //region Structure + //region structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ {"00000", "00000", "00.00", "0 0",}, @@ -88,66 +90,16 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0, true); - powerSetting = hatch_0.makeInParameter(0, 1000, POWER_SETTING_NAME, POWER_STATUS); - timerSetting = hatch_0.makeInParameter(1, 360, TIMER_SETTING_NAME, TIMER_STATUS); - - timerValue = hatch_0.makeOutParameter(0, 0, TIMER_VALUE_NAME, TIMER_STATUS); - remainingTime = hatch_0.makeOutParameter(1, 360, TIMER_REMAINING_NAME, TIMER_STATUS); - } - - @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_TM_microwave(mName); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; - } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; - } - return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; - } - - @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); - } - - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true);//todo texture - } - - @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); } @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.BASS_MARK, - translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.0"),//High Frequency Oven - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.1"),//From live to done in seconds! - EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.2"),//I said nuke the... I meant microwave supper! - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { hasBeenPausedThisCycle = false; if ((int) powerSetting.get() < 300 || timerSetting.get() <= 0 || timerSetting.get() > 3000) { @@ -232,11 +184,43 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override - public boolean onRunningTick(ItemStack aStack) { - if (eSafeVoid) { - hasBeenPausedThisCycle = true; + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.0"),//High Frequency Oven + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.1"),//From live to done in seconds! + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.microwave.desc.2"),//I said nuke the... I meant microwave supper! + }; + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, false, true, true); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, true, true);//todo texture + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], new TT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + } else if (aSide == GT_Utility.getOppositeSide(aFacing)) { + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49], aActive ? Textures.BlockIcons.CASING_BLOCKS[52] : Textures.BlockIcons.CASING_BLOCKS[53]}; } - return hasBeenPausedThisCycle || super.onRunningTick(aStack);//consume eu and other resources if not paused + return new ITexture[]{Textures.BlockIcons.CASING_BLOCKS[49]}; + } + + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0, true); + powerSetting = hatch_0.makeInParameter(0, 1000, POWER_SETTING_NAME, POWER_STATUS); + timerSetting = hatch_0.makeInParameter(1, 360, TIMER_SETTING_NAME, TIMER_STATUS); + + timerValue = hatch_0.makeOutParameter(0, 0, TIMER_VALUE_NAME, TIMER_STATUS); + remainingTime = hatch_0.makeOutParameter(1, 360, TIMER_REMAINING_NAME, TIMER_STATUS); } @Override @@ -247,7 +231,26 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock } @Override + public boolean onRunningTick(ItemStack aStack) { + if (eSafeVoid) { + hasBeenPausedThisCycle = true; + } + return hasBeenPausedThisCycle || super.onRunningTick(aStack);//consume eu and other resources if not paused + } + + //TODO Why is the basetype 1?? + @Override public byte getTileEntityBaseType() { return 1; } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 dc1a54a119..a95963f1a7 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 @@ -42,6 +42,7 @@ import static gregtech.api.enums.GT_Values.E; import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables private final static HashSet<ThaumSpark> sparkList = new HashSet<>(); private static Textures.BlockIcons.CustomIcon ScreenOFF; @@ -74,6 +75,7 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock private int[][] scanPosOffsets = new int[10][3]; private int[] posZap = new int[3];//Power Transfer Origin public int[] posTop = new int[3];//Lightning Origin + //endregion //region structure private static final String[][] shape = new String[][]{//3 16 0 @@ -231,87 +233,6 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock super(aName); } - @Override - protected void parametersInstantiation_EM() { - Parameters.Group hatch_0 = parametrization.getGroup(0, true); - Parameters.Group hatch_1 = parametrization.getGroup(1, true); - Parameters.Group hatch_2 = parametrization.getGroup(2, true); - Parameters.Group hatch_3 = parametrization.getGroup(3, true); - Parameters.Group hatch_4 = parametrization.getGroup(4, true); - Parameters.Group hatch_5 = parametrization.getGroup(5, true); - Parameters.Group hatch_6 = parametrization.getGroup(6, true); - Parameters.Group hatch_7 = parametrization.getGroup(7, true); - Parameters.Group hatch_8 = parametrization.getGroup(8, true); - Parameters.Group hatch_9 = parametrization.getGroup(9, true); - - histLowSetting = hatch_0.makeInParameter(0, 0.25, HYSTERESIS_LOW_SETTING_NAME, HYSTERESIS_LOW_STATUS); - popogaSetting = hatch_0.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - histHighSetting = hatch_1.makeInParameter(0, 0.75, HYSTERESIS_HIGH_SETTING_NAME, HYSTERESIS_HIGH_STATUS); - popogaSetting = hatch_1.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTowerSetting = hatch_2.makeInParameter(0, 32, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); - popogaSetting = hatch_2.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, 16, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, 16, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - outputVoltageSetting = hatch_4.makeInParameter(0, -1, OUTPUT_VOLTAGE_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); - popogaSetting = hatch_4.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - outputCurrentSetting = hatch_5.makeInParameter(0, -1, OUTPUT_CURRENT_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); - popogaSetting = hatch_5.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - popogaSetting = hatch_6.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaSetting = hatch_6.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - scanTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); - popogaSetting = hatch_7.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - overDriveSetting = hatch_8.makeInParameter(0, 0, OVERDRIVE_SETTING_NAME, OVERDRIVE_STATUS); - popogaSetting = hatch_8.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - popogaSetting = hatch_9.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaSetting = hatch_9.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - - popogaDisplay = hatch_0.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_0.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_1.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_1.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTowerDisplay = hatch_2.makeOutParameter(0, 0, TRANSFER_RADIUS_TOWER_DISPLAY_NAME, TRANSFER_RADIUS_TOWER_STATUS); - popogaDisplay = hatch_2.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); - outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS); - popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS); - energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS); - energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS); - energyFractionDisplay = hatch_6.makeOutParameter(1, 0, ENERGY_FRACTION_DISPLAY_NAME, ENERGY_STATUS); - scanTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); - popogaDisplay = hatch_7.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_8.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_8.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_9.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); - popogaDisplay = hatch_9.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TM_teslaCoil(mName); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerIcons(IIconRegister aBlockIconRegister) { - ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER"); - ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER_ACTIVE"); - super.registerIcons(aBlockIconRegister); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setLong("eEnergyCapacity", energyCapacity); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - energyCapacity = aNBT.getLong("eEnergyCapacity"); - } - private long getEnergyEfficiency(long voltage, int distance, boolean overDriveToggle) { if (overDriveToggle) { return (long) ((voltage * 2) - (voltage * Math.pow(overdriveEfficiency, distance))); @@ -328,37 +249,49 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return 1F; } - @Override - public long maxEUStore() { - return energyCapacity * 2; - } + private void scanForTransmissionTargets(int[] coordsMin, int[] coordsMax) { + //This makes sure the minimums are actually smaller than the maximums + int xMin = coordsMin[0] < coordsMax[0] ? coordsMin[0] : coordsMax[0]; + int yMin = coordsMin[1] < coordsMax[1] ? coordsMin[1] : coordsMax[1]; + int zMin = coordsMin[2] < coordsMax[2] ? coordsMin[2] : coordsMax[2]; + //And vice versa + int xMax = coordsMin[0] > coordsMax[0] ? coordsMin[0] : coordsMax[0]; + int yMax = coordsMin[1] > coordsMax[1] ? coordsMin[1] : coordsMax[1]; + int zMax = coordsMin[2] > coordsMax[2] ? coordsMin[2] : coordsMax[2]; - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + for (int xPos = xMin; xPos <= xMax; xPos++) { + for (int yPos = yMin; yPos <= yMax; yPos++) { + for (int zPos = zMin; zPos <= zMax; zPos++) { + if (xPos == 0 && yPos == 0 && zPos == 0) { + continue; + } + IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos); + if (node == null) { + continue; + } + IMetaTileEntity nodeInside = node.getMetaTileEntity(); + if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { + eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); + } + } + } } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6]}; + } - @Override - public void onRemoval() { - super.onRemoval(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); - } + private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { + byte xR = (byte) (node.getXCoord() - posTop[0]); + byte yR = (byte) (node.getYCoord() - posTop[1]); + byte zR = (byte) (node.getZCoord() - posTop[2]); + + int wID = mte.getWorld().provider.dimensionId; + + sparkList.add(new ThaumSpark(posTop[0], posTop[1], posTop[2], xR, yR, zR, wID)); } @Override - public void stopMachine() { - super.stopMachine(); - for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { - cap.getBaseMetaTileEntity().setActive(false); - } - - setEUVar(0); - energyStoredDisplay.set(0); - energyFractionDisplay.set(0); + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_TM_teslaCoil(mName); } @Override @@ -420,26 +353,6 @@ 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(), this, hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override - public String[] getDescription() { - return new String[]{ - CommonValues.BASS_MARK, - translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.0"),//Tower of Wireless Power - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.1"),//Fewer pesky cables! - EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.2"),//Survival chances might be affected - }; - } - - @Override public boolean checkRecipe_EM(ItemStack itemStack) { if (!histHighSetting.getStatus(false).isOk || !histLowSetting.getStatus(false).isOk || @@ -500,44 +413,118 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return true; } - private void scanForTransmissionTargets(int[] coordsMin, int[] coordsMax) { - //This makes sure the minimums are actually smaller than the maximums - int xMin = coordsMin[0] < coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMin = coordsMin[1] < coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMin = coordsMin[2] < coordsMax[2] ? coordsMin[2] : coordsMax[2]; - //And vice versa - int xMax = coordsMin[0] > coordsMax[0] ? coordsMin[0] : coordsMax[0]; - int yMax = coordsMin[1] > coordsMax[1] ? coordsMin[1] : coordsMax[1]; - int zMax = coordsMin[2] > coordsMax[2] ? coordsMin[2] : coordsMax[2]; + @Override + public String[] getDescription() { + return new String[]{ + CommonValues.BASS_MARK, + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.0"),//Tower of Wireless Power + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.1"),//Fewer pesky cables! + EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.multimachine.tm.teslaCoil.desc.2"),//Survival chances might be affected + }; + } - for (int xPos = xMin; xPos <= xMax; xPos++) { - for (int yPos = yMin; yPos <= yMax; yPos++) { - for (int zPos = zMin; zPos <= zMax; zPos++) { - if (xPos == 0 && yPos == 0 && zPos == 0) { - continue; - } - IGregTechTileEntity node = getBaseMetaTileEntity().getIGregTechTileEntityOffset(xPos, yPos, zPos); - if (node == null) { - continue; - } - IMetaTileEntity nodeInside = node.getMetaTileEntity(); - if (nodeInside instanceof GT_MetaTileEntity_TeslaCoil || nodeInside instanceof GT_MetaTileEntity_TM_teslaCoil && node.isActive() || (node.getCoverBehaviorAtSide((byte) 1) instanceof GT_Cover_TM_TeslaCoil)) { - eTeslaMap.put(node, (int) Math.ceil(Math.sqrt(Math.pow(xPos, 2) + Math.pow(yPos, 2) + Math.pow(zPos, 2)))); - } - } - } + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + ScreenOFF = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER"); + ScreenON = new Textures.BlockIcons.CustomIcon("iconsets/TM_TESLA_TOWER_ACTIVE"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; } + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][16 + 6]}; + } + @Override + public void onRemoval() { + super.onRemoval(); + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + cap.getBaseMetaTileEntity().setActive(false); + } } - private void thaumLightning(IGregTechTileEntity mte, IGregTechTileEntity node) { - byte xR = (byte) (node.getXCoord() - posTop[0]); - byte yR = (byte) (node.getYCoord() - posTop[1]); - byte zR = (byte) (node.getZCoord() - posTop[2]); + @Override + protected void parametersInstantiation_EM() { + Parameters.Group hatch_0 = parametrization.getGroup(0, true); + Parameters.Group hatch_1 = parametrization.getGroup(1, true); + Parameters.Group hatch_2 = parametrization.getGroup(2, true); + Parameters.Group hatch_3 = parametrization.getGroup(3, true); + Parameters.Group hatch_4 = parametrization.getGroup(4, true); + Parameters.Group hatch_5 = parametrization.getGroup(5, true); + Parameters.Group hatch_6 = parametrization.getGroup(6, true); + Parameters.Group hatch_7 = parametrization.getGroup(7, true); + Parameters.Group hatch_8 = parametrization.getGroup(8, true); + Parameters.Group hatch_9 = parametrization.getGroup(9, true); - int wID = mte.getWorld().provider.dimensionId; + histLowSetting = hatch_0.makeInParameter(0, 0.25, HYSTERESIS_LOW_SETTING_NAME, HYSTERESIS_LOW_STATUS); + popogaSetting = hatch_0.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + histHighSetting = hatch_1.makeInParameter(0, 0.75, HYSTERESIS_HIGH_SETTING_NAME, HYSTERESIS_HIGH_STATUS); + popogaSetting = hatch_1.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + transferRadiusTowerSetting = hatch_2.makeInParameter(0, 32, TRANSFER_RADIUS_TOWER_SETTING_NAME, TRANSFER_RADIUS_TOWER_STATUS); + popogaSetting = hatch_2.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + transferRadiusTransceiverSetting = hatch_3.makeInParameter(0, 16, TRANSFER_RADIUS_TRANSCEIVER_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusCoverUltimateSetting = hatch_3.makeInParameter(1, 16, TRANSFER_RADIUS_COVER_ULTIMATE_SETTING_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + outputVoltageSetting = hatch_4.makeInParameter(0, -1, OUTPUT_VOLTAGE_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); + popogaSetting = hatch_4.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + outputCurrentSetting = hatch_5.makeInParameter(0, -1, OUTPUT_CURRENT_SETTING_NAME, OUTPUT_VOLTAGE_OR_CURRENT_STATUS); + popogaSetting = hatch_5.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + popogaSetting = hatch_6.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaSetting = hatch_6.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + scanTimeMinSetting = hatch_7.makeInParameter(0, 100, SCAN_TIME_MIN_SETTING_NAME, SCAN_TIME_MIN_STATUS); + popogaSetting = hatch_7.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + overDriveSetting = hatch_8.makeInParameter(0, 0, OVERDRIVE_SETTING_NAME, OVERDRIVE_STATUS); + popogaSetting = hatch_8.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + popogaSetting = hatch_9.makeInParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaSetting = hatch_9.makeInParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); - sparkList.add(new ThaumSpark(posTop[0], posTop[1], posTop[2], xR, yR, zR, wID)); + popogaDisplay = hatch_0.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_0.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_1.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_1.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + transferRadiusTowerDisplay = hatch_2.makeOutParameter(0, 0, TRANSFER_RADIUS_TOWER_DISPLAY_NAME, TRANSFER_RADIUS_TOWER_STATUS); + popogaDisplay = hatch_2.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + transferRadiusTransceiverDisplay = hatch_3.makeOutParameter(0, 0, TRANSFER_RADIUS_TRANSCEIVER_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + transferRadiusCoverUltimateDisplay = hatch_3.makeOutParameter(1, 0, TRANSFER_RADIUS_COVER_ULTIMATE_DISPLAY_NAME, TRANSFER_RADIUS_TRANSCEIVER_OR_COVER_ULTIMATE_STATUS); + outputVoltageDisplay = hatch_4.makeOutParameter(0, 0, OUTPUT_VOLTAGE_DISPLAY_NAME, POWER_STATUS); + popogaDisplay = hatch_4.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + outputCurrentDisplay = hatch_5.makeOutParameter(0, 0, OUTPUT_CURRENT_DISPLAY_NAME, POWER_STATUS); + energyCapacityDisplay = hatch_5.makeOutParameter(1, 0, ENERGY_CAPACITY_DISPLAY_NAME, ENERGY_STATUS); + energyStoredDisplay = hatch_6.makeOutParameter(0, 0, ENERGY_STORED_DISPLAY_NAME, ENERGY_STATUS); + energyFractionDisplay = hatch_6.makeOutParameter(1, 0, ENERGY_FRACTION_DISPLAY_NAME, ENERGY_STATUS); + scanTimeDisplay = hatch_7.makeOutParameter(0, 0, SCAN_TIME_DISPLAY_NAME, SCAN_TIME_STATUS); + popogaDisplay = hatch_7.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_8.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_8.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_9.makeOutParameter(0, 0, POPOGA_NAME, POPOGA_STATUS); + popogaDisplay = hatch_9.makeOutParameter(1, 0, POPOGA_NAME, POPOGA_STATUS); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setLong("eEnergyCapacity", energyCapacity); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + energyCapacity = aNBT.getLong("eEnergyCapacity"); + } + + @Override + public void stopMachine() { + super.stopMachine(); + for (GT_MetaTileEntity_Hatch_Capacitor cap : eCapacitorHatches) { + cap.getBaseMetaTileEntity().setActive(false); + } + + setEUVar(0); + energyStoredDisplay.set(0); + energyFractionDisplay.set(0); } @Override @@ -787,8 +774,9 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock return true; } - private boolean addFrameToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { - return aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame; + @Override + public long maxEUStore() { + return energyCapacity * 2; } private boolean addCapacitorToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { @@ -829,4 +817,18 @@ public class GT_MetaTileEntity_TM_teslaCoil extends GT_MetaTileEntity_Multiblock } return false; } + + private boolean addFrameToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + return aTileEntity != null && aTileEntity.getMetaTileEntity() instanceof GT_MetaPipeEntity_Frame; + } + + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMetas[(stackSize - 1) % 6], 3, 16, 0, getBaseMetaTileEntity(), this, hintsOnly); + } + + @Override + public String[] getStructureDescription(int stackSize) { + return description; + } }
\ No newline at end of file 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 0ec865b1e2..54f438aa9f 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 @@ -55,7 +55,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected static Textures.BlockIcons.CustomIcon ScreenON; //Sound resource - same as with screen but override getActivitySound - public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_lo_freq"); + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_lo_freq"); @SideOnly(Side.CLIENT) private SoundLoop activitySoundLoop; //endregion @@ -117,16 +117,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region READ ONLY unless u really need to change it //max amperes machine can take in after computing it to the lowest tier (exchange packets to min tier count) - protected long eMaxAmpereFlow = 0,eMaxAmpereGen=0; + protected long eMaxAmpereFlow = 0, eMaxAmpereGen = 0; //What is the max and minimal tier of eu hatches installed - private long maxEUinputMin = 0, maxEUinputMax = 0,maxEUoutputMin = 0, maxEUoutputMax = 0; + private long maxEUinputMin = 0, maxEUinputMax = 0, maxEUoutputMin = 0, maxEUoutputMax = 0; //read only unless you are making computation generator - read computer class protected long eAvailableData = 0; // data being available //just some info - private so hidden - private boolean explodedThisTick=false; + private boolean explodedThisTick = false; //front rotation val private byte frontRotation = 0; @@ -135,37 +135,37 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected GT_MetaTileEntity_MultiblockBase_EM(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - parametrization=new Parameters(this); + parametrization = new Parameters(this); parametersInstantiation_EM(); - parametrization.setToDefaults(true,true); + parametrization.setToDefaults(true, true); } protected GT_MetaTileEntity_MultiblockBase_EM(String aName) { super(aName); - parametrization=new Parameters(this); + parametrization = new Parameters(this); parametersInstantiation_EM(); - parametrization.setToDefaults(true,true); + parametrization.setToDefaults(true, true); } //region SUPER STRUCT @Override - public boolean isFrontRotationValid(byte frontRotation, byte frontFacing){ + public boolean isFrontRotationValid(byte frontRotation, byte frontFacing) { return true; } - public boolean isFacingValid_EM(byte aFacing){ + public boolean isFacingValid_EM(byte aFacing) { return true; } @Override public void rotateAroundFrontPlane(boolean direction) { - if(direction){ + if (direction) { frontRotation++; - if(frontRotation>3) frontRotation=0; - }else { + if (frontRotation > 3) frontRotation = 0; + } else { frontRotation--; - if(frontRotation<0) frontRotation=3; + if (frontRotation < 0) frontRotation = 3; } if (isFrontRotationValid(frontRotation, getBaseMetaTileEntity().getFrontFacing())) { updateRotationOnClients(); @@ -176,6 +176,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Gets AABB based on abc and not xyz, without offsetting to controller position!!! + * * @param minA * @param minB * @param minC @@ -184,291 +185,292 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt * @param maxC * @return */ - public final AxisAlignedBB getBoundingBox(double minA,double minB,double minC,double maxA,double maxB,double maxC){ - double[] offSetsMin= getTranslatedOffsets(minA,minB,minC); - double[] offSetsMax= getTranslatedOffsets(maxA,maxB,maxC); - for (int i=0;i<3;i++){ - if(offSetsMax[i]<offSetsMin[i]){ - double temp=offSetsMax[i]; - offSetsMax[i]=offSetsMin[i]; - offSetsMin[i]=temp; + public final AxisAlignedBB getBoundingBox(double minA, double minB, double minC, double maxA, double maxB, double maxC) { + double[] offSetsMin = getTranslatedOffsets(minA, minB, minC); + double[] offSetsMax = getTranslatedOffsets(maxA, maxB, maxC); + for (int i = 0; i < 3; i++) { + if (offSetsMax[i] < offSetsMin[i]) { + double temp = offSetsMax[i]; + offSetsMax[i] = offSetsMin[i]; + offSetsMin[i] = temp; } } return AxisAlignedBB.getBoundingBox( - offSetsMin[0],offSetsMin[1],offSetsMin[2], - offSetsMax[0],offSetsMax[1],offSetsMax[2] + offSetsMin[0], offSetsMin[1], offSetsMin[2], + offSetsMax[0], offSetsMax[1], offSetsMax[2] ); } /** * Translates relative axis coordinates abc to absolute axis coordinates xyz * abc from the CONTROLLER! + * * @param a * @param b * @param c * @return */ - public final double[] getTranslatedOffsets(double a, double b, double c){ - double[] result=new double[3]; - switch (getBaseMetaTileEntity().getFrontFacing() +(frontRotation<<3)){ + public final double[] getTranslatedOffsets(double a, double b, double c) { + double[] result = new double[3]; + switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { case 4: - result[0]= c; - result[2]= a; - result[1]=- b; + result[0] = c; + result[2] = a; + result[1] = -b; break; case 12: - result[0]= c; - result[1]=- a; - result[2]=- b; + result[0] = c; + result[1] = -a; + result[2] = -b; break; case 20: - result[0]= c; - result[2]=- a; - result[1]= b; + result[0] = c; + result[2] = -a; + result[1] = b; break; case 28: - result[0]= c; - result[1]= a; - result[2]= b; + result[0] = c; + result[1] = a; + result[2] = b; break; case 3: - result[0]= a; - result[2]=- c; - result[1]=- b; + result[0] = a; + result[2] = -c; + result[1] = -b; break; case 11: - result[1]=- a; - result[2]=- c; - result[0]=- b; + result[1] = -a; + result[2] = -c; + result[0] = -b; break; case 19: - result[0]=- a; - result[2]=- c; - result[1]= b; + result[0] = -a; + result[2] = -c; + result[1] = b; break; case 27: - result[1]= a; - result[2]=- c; - result[0]= b; + result[1] = a; + result[2] = -c; + result[0] = b; break; case 5: - result[0]=- c; - result[2]=- a; - result[1]=- b; + result[0] = -c; + result[2] = -a; + result[1] = -b; break; case 13: - result[0]=- c; - result[1]=- a; - result[2]= b; + result[0] = -c; + result[1] = -a; + result[2] = b; break; case 21: - result[0]=- c; - result[2]= a; - result[1]= b; + result[0] = -c; + result[2] = a; + result[1] = b; break; case 29: - result[0]=- c; - result[1]= a; - result[2]=- b; + result[0] = -c; + result[1] = a; + result[2] = -b; break; case 2: - result[0]=- a; - result[2]= c; - result[1]=- b; + result[0] = -a; + result[2] = c; + result[1] = -b; break; case 10: - result[1]=- a; - result[2]= c; - result[0]= b; + result[1] = -a; + result[2] = c; + result[0] = b; break; case 18: - result[0]= a; - result[2]= c; - result[1]= b; + result[0] = a; + result[2] = c; + result[1] = b; break; case 26: - result[1]= a; - result[2]= c; - result[0]=- b; + result[1] = a; + result[2] = c; + result[0] = -b; break; //Things get odd if the block faces up or down... case 1: - result[0]= a; - result[2]= b; - result[1]=- c; + result[0] = a; + result[2] = b; + result[1] = -c; break;//similar to 3 case 9: - result[2]= a; - result[0]=- b; - result[1]=- c; + result[2] = a; + result[0] = -b; + result[1] = -c; break;//similar to 3 case 17: - result[0]=- a; - result[2]=- b; - result[1]=- c; + result[0] = -a; + result[2] = -b; + result[1] = -c; break;//similar to 3 case 25: - result[2]=- a; - result[0]= b; - result[1]=- c; + result[2] = -a; + result[0] = b; + result[1] = -c; break;//similar to 3 case 0: - result[0]=- a; - result[2]= b; - result[1]= c; + result[0] = -a; + result[2] = b; + result[1] = c; break;//similar to 2 case 8: - result[2]= a; - result[0]= b; - result[1]= c; + result[2] = a; + result[0] = b; + result[1] = c; break; case 16: - result[0]= a; - result[2]=- b; - result[1]= c; + result[0] = a; + result[2] = -b; + result[1] = c; break; case 24: - result[2]=- a; - result[0]=- b; - result[0]=- b; - result[1]=+ c; + result[2] = -a; + result[0] = -b; + result[0] = -b; + result[1] = +c; break; } return result; } - public final int[] getTranslatedOffsets(int a, int b, int c){ - int[] result=new int[3]; - switch (getBaseMetaTileEntity().getFrontFacing() +(frontRotation<<3)){ + public final int[] getTranslatedOffsets(int a, int b, int c) { + int[] result = new int[3]; + switch (getBaseMetaTileEntity().getFrontFacing() + (frontRotation << 3)) { case 4: - result[0]= c; - result[2]= a; - result[1]=- b; + result[0] = c; + result[2] = a; + result[1] = -b; break; case 12: - result[0]= c; - result[1]=- a; - result[2]=- b; + result[0] = c; + result[1] = -a; + result[2] = -b; break; case 20: - result[0]= c; - result[2]=- a; - result[1]= b; + result[0] = c; + result[2] = -a; + result[1] = b; break; case 28: - result[0]= c; - result[1]= a; - result[2]= b; + result[0] = c; + result[1] = a; + result[2] = b; break; case 3: - result[0]= a; - result[2]=- c; - result[1]=- b; + result[0] = a; + result[2] = -c; + result[1] = -b; break; case 11: - result[1]=- a; - result[2]=- c; - result[0]=- b; + result[1] = -a; + result[2] = -c; + result[0] = -b; break; case 19: - result[0]=- a; - result[2]=- c; - result[1]= b; + result[0] = -a; + result[2] = -c; + result[1] = b; break; case 27: - result[1]= a; - result[2]=- c; - result[0]= b; + result[1] = a; + result[2] = -c; + result[0] = b; break; case 5: - result[0]=- c; - result[2]=- a; - result[1]=- b; + result[0] = -c; + result[2] = -a; + result[1] = -b; break; case 13: - result[0]=- c; - result[1]=- a; - result[2]= b; + result[0] = -c; + result[1] = -a; + result[2] = b; break; case 21: - result[0]=- c; - result[2]= a; - result[1]= b; + result[0] = -c; + result[2] = a; + result[1] = b; break; case 29: - result[0]=- c; - result[1]= a; - result[2]=- b; + result[0] = -c; + result[1] = a; + result[2] = -b; break; case 2: - result[0]=- a; - result[2]= c; - result[1]=- b; + result[0] = -a; + result[2] = c; + result[1] = -b; break; case 10: - result[1]=- a; - result[2]= c; - result[0]= b; + result[1] = -a; + result[2] = c; + result[0] = b; break; case 18: - result[0]= a; - result[2]= c; - result[1]= b; + result[0] = a; + result[2] = c; + result[1] = b; break; case 26: - result[1]= a; - result[2]= c; - result[0]=- b; + result[1] = a; + result[2] = c; + result[0] = -b; break; //Things get odd if the block faces up or down... case 1: - result[0]= a; - result[2]= b; - result[1]=- c; + result[0] = a; + result[2] = b; + result[1] = -c; break;//similar to 3 case 9: - result[2]= a; - result[0]=- b; - result[1]=- c; + result[2] = a; + result[0] = -b; + result[1] = -c; break;//similar to 3 case 17: - result[0]=- a; - result[2]=- b; - result[1]=- c; + result[0] = -a; + result[2] = -b; + result[1] = -c; break;//similar to 3 case 25: - result[2]=- a; - result[0]= b; - result[1]=- c; + result[2] = -a; + result[0] = b; + result[1] = -c; break;//similar to 3 case 0: - result[0]=- a; - result[2]= b; - result[1]= c; + result[0] = -a; + result[2] = b; + result[1] = c; break;//similar to 2 case 8: - result[2]= a; - result[0]= b; - result[1]= c; + result[2] = a; + result[0] = b; + result[1] = c; break; case 16: - result[0]= a; - result[2]=- b; - result[1]= c; + result[0] = a; + result[2] = -b; + result[1] = c; break; case 24: - result[2]=- a; - result[0]=- b; - result[0]=- b; - result[1]=+ c; + result[2] = -a; + result[0] = -b; + result[0] = -b; + result[1] = +c; break; } return result; @@ -505,8 +507,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Check structure here, also add hatches + * * @param iGregTechTileEntity - the tile entity - * @param itemStack - what is in the controller input slot + * @param itemStack - what is in the controller input slot * @return is structure valid */ protected boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { @@ -515,12 +518,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Checks Recipes (when all machine is complete and can work) - * + * <p> * can get/set Parameters here also * * @param itemStack item in the controller * @return is recipe is valid - * */ + */ public boolean checkRecipe_EM(ItemStack itemStack) { return false; } @@ -528,22 +531,24 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Put EM stuff from outputEM into EM output hatches here * or do other stuff - it is basically on recipe succeded - * + * <p> * based on "machine state" do output, * this must move to outputEM to EM output hatches * and can also modify output items/fluids/EM, remaining EM is NOT overflowed. * (Well it can be overflowed if machine didn't finished, soft-hammered/disabled/not enough EU) * Setting available data processing */ - public void outputAfterRecipe_EM() {} + public void outputAfterRecipe_EM() { + } /** * to add fluids into hatches + * * @param mOutputFluids */ @Override protected void addFluidOutputs(FluidStack[] mOutputFluids) { - int min=mOutputFluids.length>mOutputHatches.size()?mOutputHatches.size():mOutputFluids.length; + int min = mOutputFluids.length > mOutputHatches.size() ? mOutputHatches.size() : mOutputFluids.length; for (int i = 0; i < min; ++i) { if (mOutputHatches.get(i) != null && mOutputFluids[i] != null && GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(mOutputHatches.get(i))) { mOutputHatches.get(i).fill(mOutputFluids[i], true); @@ -555,48 +560,46 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region tooltip and scanner result /** - * * @param hatchNo * @param paramID * @return */ - public ArrayList<String> getFullLedDescriptionIn(int hatchNo, int paramID){ - ArrayList<String> list=new ArrayList<>(); - list.add(EnumChatFormatting.WHITE+"ID: " + - EnumChatFormatting.AQUA+hatchNo + - EnumChatFormatting.YELLOW+ ":" + - EnumChatFormatting.AQUA+paramID + - EnumChatFormatting.YELLOW+ ":"+ - EnumChatFormatting.AQUA+"I "+parametrization.getStatusIn(hatchNo, paramID).name.get()); - list.add(EnumChatFormatting.WHITE+"Value: "+ - EnumChatFormatting.AQUA+ Util.doubleToString(parametrization.getIn(hatchNo,paramID))); - try{ + public ArrayList<String> getFullLedDescriptionIn(int hatchNo, int paramID) { + ArrayList<String> list = new ArrayList<>(); + list.add(EnumChatFormatting.WHITE + "ID: " + + EnumChatFormatting.AQUA + hatchNo + + EnumChatFormatting.YELLOW + ":" + + EnumChatFormatting.AQUA + paramID + + EnumChatFormatting.YELLOW + ":" + + EnumChatFormatting.AQUA + "I " + parametrization.getStatusIn(hatchNo, paramID).name.get()); + list.add(EnumChatFormatting.WHITE + "Value: " + + EnumChatFormatting.AQUA + Util.doubleToString(parametrization.getIn(hatchNo, paramID))); + try { list.add(parametrization.groups[hatchNo].parameterIn[paramID].getBrief()); - }catch (NullPointerException|IndexOutOfBoundsException e){ + } catch (NullPointerException | IndexOutOfBoundsException e) { list.add("Unused"); } return list; } /** - * * @param hatchNo * @param paramID * @return */ - public ArrayList<String> getFullLedDescriptionOut(int hatchNo, int paramID){ - ArrayList<String> list=new ArrayList<>(); - list.add(EnumChatFormatting.WHITE+"ID: " + - EnumChatFormatting.AQUA+hatchNo + - EnumChatFormatting.YELLOW+ ":" + - EnumChatFormatting.AQUA+paramID + - EnumChatFormatting.YELLOW+ ":"+ - EnumChatFormatting.AQUA+"O "+parametrization.getStatusOut(hatchNo, paramID).name.get()); - list.add(EnumChatFormatting.WHITE+"Value: "+ - EnumChatFormatting.AQUA+Util.doubleToString(parametrization.getOut(hatchNo,paramID))); - try{ + public ArrayList<String> getFullLedDescriptionOut(int hatchNo, int paramID) { + ArrayList<String> list = new ArrayList<>(); + list.add(EnumChatFormatting.WHITE + "ID: " + + EnumChatFormatting.AQUA + hatchNo + + EnumChatFormatting.YELLOW + ":" + + EnumChatFormatting.AQUA + paramID + + EnumChatFormatting.YELLOW + ":" + + EnumChatFormatting.AQUA + "O " + parametrization.getStatusOut(hatchNo, paramID).name.get()); + list.add(EnumChatFormatting.WHITE + "Value: " + + EnumChatFormatting.AQUA + Util.doubleToString(parametrization.getOut(hatchNo, paramID))); + try { list.add(parametrization.groups[hatchNo].parameterOut[paramID].getBrief()); - }catch (NullPointerException|IndexOutOfBoundsException e){ + } catch (NullPointerException | IndexOutOfBoundsException e) { list.add("Unused"); } return list; @@ -604,6 +607,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * TOOLTIP + * * @return strings in tooltip */ @Override @@ -616,6 +620,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * scanner gives it + * * @return */ @Override @@ -642,7 +647,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt "Energy Hatches:", EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", - (mEUt*eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + + (mEUt * eAmpereFlow <= 0 ? "Probably uses: " : "Probably makes: ") + EnumChatFormatting.RED + Math.abs(mEUt) + EnumChatFormatting.RESET + " EU/t at " + EnumChatFormatting.RED + eAmpereFlow + EnumChatFormatting.RESET + " A", "Tier Rating: " + EnumChatFormatting.YELLOW + VN[getMaxEnergyInputTier_EM()] + EnumChatFormatting.RESET + " / " + EnumChatFormatting.GREEN + VN[getMinEnergyInputTier_EM()] + EnumChatFormatting.RESET + @@ -657,6 +662,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * should it work with scanner? HELL YES + * * @return */ @Override @@ -670,6 +676,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Server side container + * * @param aID * @param aPlayerInventory * @param aBaseMetaTileEntity @@ -682,6 +689,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * Client side gui + * * @param aID * @param aPlayerInventory * @param aBaseMetaTileEntity @@ -695,6 +703,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * add more textures + * * @param aBlockIconRegister */ @Override @@ -707,6 +716,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * actually use textures + * * @param aBaseMetaTileEntity * @param aSide * @param aFacing @@ -725,26 +735,28 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * should return your activity sound + * * @return */ @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ + protected ResourceLocation getActivitySound() { return activitySound; } /** * plays the sounds auto magically + * * @param activitySound */ @SideOnly(Side.CLIENT) - protected void soundMagic(ResourceLocation activitySound){ - if(getBaseMetaTileEntity().isActive()){ - if(activitySoundLoop==null){ - activitySoundLoop =new SoundLoop(activitySound,getBaseMetaTileEntity(),false,true); + protected void soundMagic(ResourceLocation activitySound) { + if (getBaseMetaTileEntity().isActive()) { + if (activitySoundLoop == null) { + activitySoundLoop = new SoundLoop(activitySound, getBaseMetaTileEntity(), false, true); Minecraft.getMinecraft().getSoundHandler().playSound(activitySoundLoop); } - }else { - if(activitySoundLoop!=null) { + } else { + if (activitySoundLoop != null) { activitySoundLoop = null; } } @@ -756,6 +768,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * is the thing inside controller a valid item to make the machine work + * * @param itemStack * @return */ @@ -766,6 +779,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * how much damage to apply to thing in controller - not sure how it does it + * * @param itemStack * @return */ @@ -802,7 +816,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } cleanOutputEM_EM(); - if (ePowerPass && getEUVar()>V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) { + if (ePowerPass && getEUVar() > V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) { explodeMultiblock(); } } catch (Exception e) { @@ -815,14 +829,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * prevents spontaneous explosions when the chunks unloading would cause them * should cover 3 chunks radius + * * @return */ - protected boolean areChunksAroundLoaded_EM(){ - if(GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ - IGregTechTileEntity base=getBaseMetaTileEntity(); - return base.getWorld().doChunksNearChunkExist(base.getXCoord(),base.getYCoord(),base.getZCoord(),3); + protected boolean areChunksAroundLoaded_EM() { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()) { + IGregTechTileEntity base = getBaseMetaTileEntity(); + return base.getWorld().doChunksNearChunkExist(base.getXCoord(), base.getYCoord(), base.getZCoord(), 3); //todo check if it is actually checking if chunks are loaded - }else { + } else { return false; } } @@ -830,29 +845,30 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * instantiate parameters in CONSTRUCTOR! CALLED ONCE on creation, don't call it in your classes */ - protected void parametersInstantiation_EM(){} + protected void parametersInstantiation_EM() { + } /** * It is automatically called OFTEN * update status of parameters in guis (and "machine state" if u wish) * Called before check recipe, before outputting, and every second the machine is complete - * + * <p> * good place to update parameter statuses, default implementation handles it well * * @param machineBusy is machine doing SHIT */ protected void parametersStatusesWrite_EM(boolean machineBusy) {//todo unimplement? - if(!machineBusy){ + if (!machineBusy) { for (Parameters.Group.ParameterIn parameterIn : parametrization.parameterInArrayList) { if (parameterIn != null) { parameterIn.updateStatus(); } } - }else{ - for (Parameters.Group hatch:parametrization.groups){ - if(hatch!=null && hatch.updateWhileRunning){ - for (Parameters.Group.ParameterIn in:hatch.parameterIn) { - if(in!=null){ + } else { + for (Parameters.Group hatch : parametrization.groups) { + if (hatch != null && hatch.updateWhileRunning) { + for (Parameters.Group.ParameterIn in : hatch.parameterIn) { + if (in != null) { in.updateStatus(); } } @@ -868,17 +884,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * For extra types of hatches initiation, LOOK HOW IT IS CALLED! in onPostTick + * * @param mMachine was the machine considered complete at that point in onPostTick */ - protected void hatchInit_EM(boolean mMachine) {} + protected void hatchInit_EM(boolean mMachine) { + } /** * called when the multiblock is exploding - if u want to add more EXPLOSIONS, for ex. new types of hatches also have to explode */ - protected void extraExplosions_EM() {}//For that extra hatches explosions, and maybe some MOORE EXPLOSIONS + protected void extraExplosions_EM() { + }//For that extra hatches explosions, and maybe some MOORE EXPLOSIONS /** * Get Available data, Override only on data outputters should return mAvailableData that is set in check recipe + * * @return available data */ protected long getAvailableData_EM() { @@ -886,8 +906,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) { if (in.q != null) { - Long value=in.q.contentIfNotInTrace(pos); - if(value!=null) { + Long value = in.q.contentIfNotInTrace(pos); + if (value != null) { result += value; } } @@ -906,6 +926,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * get pollution per tick + * * @param itemStack what is in controller * @return how much pollution is produced */ @@ -916,6 +937,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * EM pollution per tick + * * @param itemStack - item in controller * @return how much excess matter is there */ @@ -926,15 +948,16 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * triggered if machine is not allowed to work after completing a recipe, override to make it not shutdown for instance (like turbines). * bu just replacing it with blank - active transformer is doing it - * + * <p> * CALLED DIRECTLY when soft hammered to offline state - usually should stop the machine unless some other mechanics should do it */ - protected void notAllowedToWork_stopMachine_EM(){ + protected void notAllowedToWork_stopMachine_EM() { stopMachine(); } /** * store data + * * @param aNBT */ @Override @@ -952,7 +975,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt aNBT.setByte("eCertainM", eCertainMode); aNBT.setByte("eCertainS", eCertainStatus); aNBT.setByte("eMinRepair", minRepairStatus); - aNBT.setByte("eRotation",frontRotation); + aNBT.setByte("eRotation", frontRotation); aNBT.setBoolean("eParam", eParameters); aNBT.setBoolean("ePass", ePowerPass); aNBT.setBoolean("eVoid", eSafeVoid); @@ -1024,6 +1047,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * load data + * * @param aNBT */ @Override @@ -1069,7 +1093,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt int outputLen = aNBT.getInteger("eOutputStackCount"); if (outputLen > 0) { outputEM = new cElementalInstanceStackMap[outputLen]; - NBTTagCompound compound=aNBT.getCompoundTag("outputEM"); + NBTTagCompound compound = aNBT.getCompoundTag("outputEM"); for (int i = 0; i < outputEM.length; i++) { if (compound.hasKey(Integer.toString(i))) { try { @@ -1086,20 +1110,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt outputEM = null; } - if(aNBT.hasKey("eParamsIn") && aNBT.hasKey("eParamsOut") && aNBT.hasKey("eParamsB")){ + if (aNBT.hasKey("eParamsIn") && aNBT.hasKey("eParamsOut") && aNBT.hasKey("eParamsB")) { NBTTagCompound paramI = aNBT.getCompoundTag("eParamsIn"); NBTTagCompound paramO = aNBT.getCompoundTag("eParamsOut"); NBTTagCompound paramB = aNBT.getCompoundTag("eParamsB"); for (int i = 0; i < 10; i++) { - if(paramB.getBoolean(Integer.toString(i))){ + if (paramB.getBoolean(Integer.toString(i))) { parametrization.iParamsIn[i] = Float.intBitsToFloat(paramI.getInteger(Integer.toString(i))); - parametrization.iParamsOut[i] =Float.intBitsToFloat(paramO.getInteger(Integer.toString(i))); - }else { + parametrization.iParamsOut[i] = Float.intBitsToFloat(paramO.getInteger(Integer.toString(i))); + } else { parametrization.iParamsIn[i] = paramI.getInteger(Integer.toString(i)); parametrization.iParamsOut[i] = paramO.getInteger(Integer.toString(i)); } } - }else{ + } else { NBTTagCompound paramI = aNBT.getCompoundTag("eParamsInD"); for (int i = 0; i < parametrization.iParamsIn.length; i++) { parametrization.iParamsIn[i] = paramI.getDouble(Integer.toString(i)); @@ -1123,6 +1147,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * if u want to use gt recipe maps... + * * @return */ @Override @@ -1170,7 +1195,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt * After recipe check failed * helper method so i don't have to set that params to nothing at all times */ - protected void afterRecipeCheckFailed(){ + protected void afterRecipeCheckFailed() { cleanOrExplode(); for (GT_MetaTileEntity_Hatch_OutputData data : eOutputData) { @@ -1214,6 +1239,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * cyclic check even when not working, called LESS frequently + * * @return */ private boolean cyclicUpdate() { @@ -1226,6 +1252,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * mining level... + * * @return */ @Override @@ -1245,15 +1272,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final void forceSetRotationDoRender(byte rotation) { frontRotation = rotation; - IGregTechTileEntity base=getBaseMetaTileEntity(); - if(base.isClientSide()) { + IGregTechTileEntity base = getBaseMetaTileEntity(); + if (base.isClientSide()) { base.issueTextureUpdate(); } } - protected final void updateRotationOnClients(){ - if(getBaseMetaTileEntity().isServerSide()){ - IGregTechTileEntity base=getBaseMetaTileEntity(); + protected final void updateRotationOnClients() { + if (getBaseMetaTileEntity().isServerSide()) { + IGregTechTileEntity base = getBaseMetaTileEntity(); NetworkDispatcher.INSTANCE.sendToAllAround(new RotationMessage.RotationData(this), base.getWorld().provider.dimensionId, base.getXCoord(), @@ -1273,6 +1300,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * internal check machine + * * @param iGregTechTileEntity * @param itemStack * @return @@ -1284,13 +1312,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * internal check recipe + * * @param itemStack * @return */ @Override public final boolean checkRecipe(ItemStack itemStack) {//do recipe checks, based on "machine content and state" hatchesStatusUpdate_EM(); - boolean result= checkRecipe_EM(itemStack);//if had no - set default params + boolean result = checkRecipe_EM(itemStack);//if had no - set default params hatchesStatusUpdate_EM(); return result; } @@ -1299,17 +1328,17 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt * callback for updating parameters and new hatches */ protected void hatchesStatusUpdate_EM() { - if(getBaseMetaTileEntity().isClientSide()){ + if (getBaseMetaTileEntity().isClientSide()) { return; } - boolean busy=mMaxProgresstime>0; + boolean busy = mMaxProgresstime > 0; if (busy) {//write from buffer to hatches only for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) { continue; } int hatchId = hatch.param; - if(parametrization.groups[hatchId]!=null && parametrization.groups[hatchId].updateWhileRunning){ + if (parametrization.groups[hatchId] != null && parametrization.groups[hatchId].updateWhileRunning) { parametrization.iParamsIn[hatchId] = hatch.value0D; parametrization.iParamsIn[hatchId + 10] = hatch.value1D; } @@ -1343,12 +1372,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region TICKING functions - public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity){} + public void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { + } @Override public final void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { isFacingValid(aBaseMetaTileEntity.getFrontFacing()); - if(getBaseMetaTileEntity().isClientSide()){ + if (getBaseMetaTileEntity().isClientSide()) { NetworkDispatcher.INSTANCE.sendToServer(new RotationMessage.RotationQuery(this)); } onFirstTick_EM(aBaseMetaTileEntity); @@ -1356,18 +1386,19 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt /** * called every tick the machines is active + * * @param aStack * @return */ @Override public boolean onRunningTick(ItemStack aStack) { if (eRequiredData > eAvailableData) { - if(energyFlowOnRunningTick(aStack,false)) { + if (energyFlowOnRunningTick(aStack, false)) { stopMachine(); } return false; } - return energyFlowOnRunningTick(aStack,true); + return energyFlowOnRunningTick(aStack, true); } /** @@ -1376,7 +1407,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { - explodedThisTick=false; + explodedThisTick = false; if (mEfficiency < 0) { mEfficiency = 0; } @@ -1568,7 +1599,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt hatch.getBaseMetaTileEntity().setActive(true); } } - for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches){ + for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { hatch.getBaseMetaTileEntity().setActive(true); } @@ -1649,7 +1680,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } for (GT_MetaTileEntity_Hatch_OutputElemental out : eOutputHatches) { for (cElementalInstanceStack instance : out.getContainerHandler().values()) { - long qty = (long)Math.floor(remaining / instance.definition.getMass()); + long qty = (long) Math.floor(remaining / instance.definition.getMass()); if (qty > 0) { qty = Math.min(qty, instance.amount); if (voider.addOverflowMatter(instance.definition.getMass() * qty)) { @@ -1692,12 +1723,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - if (ePowerPass && getEUVar()>getMinimumStoredEU()) { + if (ePowerPass && getEUVar() > getMinimumStoredEU()) { for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, 1), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1706,7 +1737,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && - aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,tHatch.Amperes), false)) { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7, tHatch.Amperes), false)) { tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } @@ -1757,7 +1788,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); - }else { + } else { afterRecipeCheckFailed(); } updateSlots(); @@ -1772,7 +1803,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); - }else { + } else { afterRecipeCheckFailed(); } updateSlots(); @@ -1792,7 +1823,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) { aMuffler.getBaseMetaTileEntity().setActive(active); } - }else{ + } else { soundMagic(getActivitySound()); } } @@ -1826,7 +1857,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (allowProduction && euFlow > 0) { addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { - if (!drainEnergyInput_EM(mEUt,(long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { + if (!drainEnergyInput_EM(mEUt, (long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { stopMachine(); return false; } @@ -1849,7 +1880,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public long maxEUStore() { - return Math.max(maxEUinputMin * (eMaxAmpereFlow << 3),maxEUoutputMin*(eMaxAmpereGen << 3)); + return Math.max(maxEUinputMin * (eMaxAmpereFlow << 3), maxEUoutputMin * (eMaxAmpereGen << 3)); } @Override @@ -1897,16 +1928,15 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } /** - * * @param EU * @param Amperes * @return if was able to put inside the hatches */ private boolean addEnergyOutput_EM(long EU, long Amperes) { - if(EU<0) { + if (EU < 0) { EU = -EU; } - if(Amperes<0) { + if (Amperes < 0) { Amperes = -Amperes; } long euVar = EU * Amperes; @@ -1945,7 +1975,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } } - setEUVar(Math.min(getEUVar() + euVar,maxEUStore())); + setEUVar(Math.min(getEUVar() + euVar, maxEUStore())); return false; } @@ -1969,19 +1999,19 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } private boolean drainEnergyInput_EM(long EUtTierVoltage, long EUtEffective, long Amperes) { - if(EUtTierVoltage<0) { + if (EUtTierVoltage < 0) { EUtTierVoltage = -EUtTierVoltage; } - if(EUtEffective<0) { + if (EUtEffective < 0) { EUtEffective = -EUtEffective; } - if(Amperes<0) { + if (Amperes < 0) { Amperes = -Amperes; } long EUuse = EUtEffective * Amperes; if (EUuse > getEUVar() || //not enough power EUtTierVoltage > maxEUinputMax || //TIER IS BASED ON BEST HATCH! not total EUtEffective input - (EUtTierVoltage*Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A + (EUtTierVoltage * Amperes - 1) / maxEUinputMin + 1 > eMaxAmpereFlow) {// EUuse==0? --> (EUuse - 1) / maxEUinputMin + 1 = 1! //if not too much A if (DEBUG_MODE) { TecTech.LOGGER.debug("L1 " + EUuse + ' ' + getEUVar() + ' ' + (EUuse > getEUVar())); TecTech.LOGGER.debug("L2 " + EUtEffective + ' ' + maxEUinputMax + ' ' + (EUtEffective > maxEUinputMax)); @@ -2036,7 +2066,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } //new Method - public final long getMaxInputEnergy(){ + public final long getMaxInputEnergy() { long energy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { @@ -2061,7 +2091,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt return getTier(maxEUinputMin); } - public final long getMaxAmpereFlowAtMinTierOfEnergyHatches(){ + public final long getMaxAmpereFlowAtMinTierOfEnergyHatches() { return eAmpereFlow; } @@ -2069,21 +2099,21 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //region convenience copies input and output EM //new Method - public final cElementalInstanceStackMap getInputsClone_EM(){ - cElementalInstanceStackMap in=new cElementalInstanceStackMap(); - for(GT_MetaTileEntity_Hatch_ElementalContainer hatch:eInputHatches){ + public final cElementalInstanceStackMap getInputsClone_EM() { + cElementalInstanceStackMap in = new cElementalInstanceStackMap(); + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eInputHatches) { in.putUnifyAll(hatch.getContainerHandler()); } - return in.hasStacks()?in:null; + return in.hasStacks() ? in : null; } //new Method - public final cElementalInstanceStackMap getOutputsClone_EM(){ - cElementalInstanceStackMap out=new cElementalInstanceStackMap(); - for(GT_MetaTileEntity_Hatch_ElementalContainer hatch:eOutputHatches){ + public final cElementalInstanceStackMap getOutputsClone_EM() { + cElementalInstanceStackMap out = new cElementalInstanceStackMap(); + for (GT_MetaTileEntity_Hatch_ElementalContainer hatch : eOutputHatches) { out.putUnifyAll(hatch.getContainerHandler()); } - return out.hasStacks()?out:null; + return out.hasStacks() ? out : null; } //endregion @@ -2124,18 +2154,18 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public void cleanMassEM_EM(float mass) { if (mass > 0) { if (eMufflerHatches.size() < 1) { - TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(),mass); + TecTech.anomalyHandler.addAnomaly(getBaseMetaTileEntity(), mass); explodeMultiblock(); return; } mass /= eMufflerHatches.size(); - boolean shouldExplode=false; + boolean shouldExplode = false; for (GT_MetaTileEntity_Hatch_OverflowElemental dump : eMufflerHatches) { if (dump.addOverflowMatter(mass)) { - shouldExplode=true; + shouldExplode = true; } } - if(shouldExplode){ + if (shouldExplode) { explodeMultiblock(); } } @@ -2165,10 +2195,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final void explodeMultiblock() { - if(explodedThisTick) { + if (explodedThisTick) { return; } - explodedThisTick=true; + explodedThisTick = true; if (!TecTech.configTecTech.BOOM_ENABLE) { TecTech.proxy.broadcast("Multi Explode BOOM! " + getBaseMetaTileEntity().getXCoord() + ' ' + getBaseMetaTileEntity().getYCoord() + ' ' + getBaseMetaTileEntity().getZCoord()); StackTraceElement[] ste = Thread.currentThread().getStackTrace(); @@ -2728,4 +2758,5 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } return false; } -} + //endregion +}
\ No newline at end of file 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 39871910d9..f928e99925 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 @@ -30,10 +30,12 @@ import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStat * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + //region variables public static final String machine = "EM Machinery"; private ItemStack loadedMachine; private IBehaviour currentBehaviour; + //endregion //region structure private static final String[][] shape = new String[][]{ @@ -94,6 +96,95 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa super(aName); } + private boolean setCurrentBehaviour(){ + ItemStack newMachine=mInventory[1]; + if(ItemStack.areItemStacksEqual(newMachine, loadedMachine)){ + return false; + } + loadedMachine=newMachine; + Supplier<IBehaviour> behaviourSupplier=GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine)); + if(currentBehaviour==null && behaviourSupplier==null) { + return false; + } + if(currentBehaviour!=null){ + for(int i=6;i<10;i++){ + parametrization.removeGroup(i); + } + } + if(behaviourSupplier!=null){ + currentBehaviour=behaviourSupplier.get(); + currentBehaviour.parametersInstantiation(this, parametrization); + for(int i=6;i<10;i++){ + parametrization.setToDefaults(i,true,true); + } + } else { + currentBehaviour=null; + } + + return true; + } + + private static final HashMap<Util.ItemStack_NoNBT, Supplier<IBehaviour>> BEHAVIOUR_MAP = new HashMap<>(); + + public static void registerBehaviour(Supplier<IBehaviour> behaviour, ItemStack is) { + BEHAVIOUR_MAP.put(new Util.ItemStack_NoNBT(is), behaviour); + TecTech.LOGGER.info("Registered EM machine behaviour "+behaviour.get().getClass().getSimpleName()+' '+new Util.ItemStack_NoNBT(is).toString()); + } + + public interface IBehaviour { + /** + * instantiate parameters, u can also check machine tier here + * @param te + * @param parameters + */ + void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters); + + /** + * handle parameters per recipe + * @param te this te instance + * @param parameters of this te + * @return return true if machine can start with current parameters, false if not + */ + boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters); + + /** + * do recipe handling + * @param inputs from muxed inputs + * @param parameters array passed from previous method! + * @return null if recipe should not start, control object to set machine state and start recipe + */ + MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); + } + + private void quantumStuff(boolean shouldIExist){ + IGregTechTileEntity base=getBaseMetaTileEntity(); + if(base!=null && base.getWorld()!=null) { + int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2+base.getXCoord(); + int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2+base.getYCoord(); + int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2+base.getZCoord(); + Block block = base.getWorld().getBlock(xDir, yDir, zDir); + if (shouldIExist) { + if(block != null && block.getMaterial()== Material.air) { + base.getWorld().setBlock(xDir, yDir, zDir, QuantumStuffBlock.INSTANCE, 0, 2); + } + } else { + if (block instanceof QuantumStuffBlock) { + base.getWorld().setBlock(xDir, yDir, zDir, Blocks.air, 0, 2); + } + } + } + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_EM_machine(mName); + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { + return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); + } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); @@ -122,26 +213,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_machine(mName); - } - - @Override - public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 1); - } - - @Override - public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), this,hintsOnly); - } - - @Override - public String[] getStructureDescription(int stackSize) { - return description; - } - - @Override public String[] getDescription() { return new String[]{CommonValues.TEC_MARK_EM, "Processing quantum matter since...", EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "the time u started using it."}; } @@ -155,21 +226,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if(aBaseMetaTileEntity.isClientSide() && (aTick & 0x2)==0){ - if((aTick&0x10)==0) { - setCurrentBehaviour(); - } - if(aBaseMetaTileEntity.isActive()){ - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX*2+aBaseMetaTileEntity.getXCoord(); - int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY*2+aBaseMetaTileEntity.getYCoord(); - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ*2+aBaseMetaTileEntity.getZCoord(); - aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir,yDir,zDir,xDir,yDir,zDir); - } - } - } - - @Override public void onRemoval() { quantumStuff(false); super.onRemoval(); @@ -225,6 +281,13 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa return polluted; } + + @Override + public void stopMachine() { + quantumStuff(false); + super.stopMachine(); + } + @Override protected void afterRecipeCheckFailed() { quantumStuff(false); @@ -256,12 +319,6 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa } @Override - public void stopMachine() { - quantumStuff(false); - super.stopMachine(); - } - - @Override public void parametersStatusesWrite_EM(boolean machineBusy) { if (!machineBusy) { setCurrentBehaviour(); @@ -269,82 +326,28 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa super.parametersStatusesWrite_EM(machineBusy); } - private boolean setCurrentBehaviour(){ - ItemStack newMachine=mInventory[1]; - if(ItemStack.areItemStacksEqual(newMachine, loadedMachine)){ - return false; - } - loadedMachine=newMachine; - Supplier<IBehaviour> behaviourSupplier=GT_MetaTileEntity_EM_machine.BEHAVIOUR_MAP.get(new Util.ItemStack_NoNBT(newMachine)); - if(currentBehaviour==null && behaviourSupplier==null) { - return false; - } - if(currentBehaviour!=null){ - for(int i=6;i<10;i++){ - parametrization.removeGroup(i); + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if(aBaseMetaTileEntity.isClientSide() && (aTick & 0x2)==0){ + if((aTick&0x10)==0) { + setCurrentBehaviour(); } - } - if(behaviourSupplier!=null){ - currentBehaviour=behaviourSupplier.get(); - currentBehaviour.parametersInstantiation(this, parametrization); - for(int i=6;i<10;i++){ - parametrization.setToDefaults(i,true,true); + if(aBaseMetaTileEntity.isActive()){ + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX*2+aBaseMetaTileEntity.getXCoord(); + int yDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetY*2+aBaseMetaTileEntity.getYCoord(); + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ*2+aBaseMetaTileEntity.getZCoord(); + aBaseMetaTileEntity.getWorld().markBlockRangeForRenderUpdate(xDir,yDir,zDir,xDir,yDir,zDir); } - } else { - currentBehaviour=null; } - - return true; - } - - private static final HashMap<Util.ItemStack_NoNBT, Supplier<IBehaviour>> BEHAVIOUR_MAP = new HashMap<>(); - - public static void registerBehaviour(Supplier<IBehaviour> behaviour, ItemStack is) { - BEHAVIOUR_MAP.put(new Util.ItemStack_NoNBT(is), behaviour); - TecTech.LOGGER.info("Registered EM machine behaviour "+behaviour.get().getClass().getSimpleName()+' '+new Util.ItemStack_NoNBT(is).toString()); } - public interface IBehaviour { - /** - * instantiate parameters, u can also check machine tier here - * @param te - * @param parameters - */ - void parametersInstantiation(GT_MetaTileEntity_EM_machine te, Parameters parameters); - - /** - * handle parameters per recipe - * @param te this te instance - * @param parameters of this te - * @return return true if machine can start with current parameters, false if not - */ - boolean checkParametersInAndSetStatuses(GT_MetaTileEntity_EM_machine te, Parameters parameters); - - /** - * do recipe handling - * @param inputs from muxed inputs - * @param parameters array passed from previous method! - * @return null if recipe should not start, control object to set machine state and start recipe - */ - MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, GT_MetaTileEntity_EM_machine te, Parameters parameters); + @Override + public void construct(int stackSize, boolean hintsOnly) { + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 1, getBaseMetaTileEntity(), this,hintsOnly); } - private void quantumStuff(boolean shouldExist){ - IGregTechTileEntity base=getBaseMetaTileEntity(); - if(base!=null && base.getWorld()!=null) { - int xDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetX * 2+base.getXCoord(); - int yDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetY * 2+base.getYCoord(); - int zDir = ForgeDirection.getOrientation(base.getBackFacing()).offsetZ * 2+base.getZCoord(); - Block block = base.getWorld().getBlock(xDir, yDir, zDir); - if (shouldExist) { - if(block != null && block.getMaterial()== Material.air) { - base.getWorld().setBlock(xDir, yDir, zDir, QuantumStuffBlock.INSTANCE, 0, 2); - } - } else { - if (block instanceof QuantumStuffBlock) { - base.getWorld().setBlock(xDir, yDir, zDir, Blocks.air, 0, 2); - } - } - } + @Override + public String[] getStructureDescription(int stackSize) { + return description; } -} +}
\ No newline at end of file |