diff options
author | Bass <tudurap.com@gmail.com> | 2019-08-29 18:46:53 +0100 |
---|---|---|
committer | Bass <tudurap.com@gmail.com> | 2019-08-29 18:46:53 +0100 |
commit | cec23e300f5dbfc443d6daa624015b6baa359737 (patch) | |
tree | 5be92534401877d432ef4558b0c5c6533e7a44c4 /src/main/java | |
parent | f1b31fe92aecf49c727c24a4bcd29475a9707ac7 (diff) | |
download | GT5-Unofficial-cec23e300f5dbfc443d6daa624015b6baa359737.tar.gz GT5-Unofficial-cec23e300f5dbfc443d6daa624015b6baa359737.tar.bz2 GT5-Unofficial-cec23e300f5dbfc443d6daa624015b6baa359737.zip |
more lang
Diffstat (limited to 'src/main/java')
7 files changed, 405 insertions, 395 deletions
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 1dc80606d9..5d3a700153 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 @@ -42,6 +42,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.12.2016. @@ -52,44 +53,47 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static Textures.BlockIcons.CustomIcon ScreenON_Slave; private static Textures.BlockIcons.CustomIcon ScreenOFF_Slave; - protected static final byte FUSE_MODE=0, COLLIDE_MODE =1; + protected static final byte FUSE_MODE = 0, COLLIDE_MODE = 1; private static double MASS_TO_EU_INSTANT; - private static int STARTUP_COST,KEEPUP_COST; + private static int STARTUP_COST, KEEPUP_COST; - public static void setValues(int heliumPlasmaValue){ + 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; + STARTUP_COST = -heliumPlasmaValue * 10000; + KEEPUP_COST = -heliumPlasmaValue; } //region collision handlers - public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS =new HashMap<>(); - public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS =new HashMap<>(); + public static final HashMap<Integer, IColliderHandler> FUSE_HANDLERS = new HashMap<>(); + public static final HashMap<String, IPrimitiveColliderHandler> PRIMITIVE_FUSE_HANDLERS = new HashMap<>(); + public interface IPrimitiveColliderHandler { void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out); } + public interface IColliderHandler extends IPrimitiveColliderHandler { byte getRequiredTier(); } + static { FUSE_HANDLERS.put((dAtomDefinition.getClassTypeStatic() << 16) | dAtomDefinition.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return; } - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } } @@ -106,19 +110,19 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnifyAll(in2.definition.getSubParticles()); dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return; } - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } } @@ -131,19 +135,19 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return; } - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } } @@ -159,11 +163,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB FUSE_HANDLERS.put((cElementalPrimitive.getClassTypeStatic() << 16) | cElementalPrimitive.getClassTypeStatic(), new IColliderHandler() { @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { - IPrimitiveColliderHandler collisionHandler= PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName()+'\0'+in2.definition.getClass().getName()); + IPrimitiveColliderHandler collisionHandler = PRIMITIVE_FUSE_HANDLERS.get(in1.definition.getClass().getName() + '\0' + in2.definition.getClass().getName()); if (collisionHandler != null) { collisionHandler.collide(in2, in1, out); } else { - out.putUnifyAll(in1,in2); + out.putUnifyAll(in1, in2); } } @@ -175,40 +179,40 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB PRIMITIVE_FUSE_HANDLERS.put(eQuarkDefinition.class.getName() + '\0' + eQuarkDefinition.class.getName(), (in1, in2, out) -> { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); dHadronDefinition hadron = new dHadronDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(hadron,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(hadron, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return; } - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } }); PRIMITIVE_FUSE_HANDLERS.put(ePrimalAspectDefinition.class.getName() + '\0' + ePrimalAspectDefinition.class.getName(), (in1, in2, out) -> { if (fuseAspects(in1, in2, out)) return; - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } }); } private static boolean fuseAspects(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnify(in1.definition.getStackForm(1)); defs.putUnify(in2.definition.getStackForm(1)); dComplexAspectDefinition aspect = new dComplexAspectDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(aspect,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(aspect, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return true; } return false; @@ -219,10 +223,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { if (fuseAspects(in1, in2, out)) return; - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } } @@ -238,19 +242,19 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void collide(cElementalInstanceStack in1, cElementalInstanceStack in2, cElementalInstanceStackMap out) { try { - cElementalMutableDefinitionStackMap defs=new cElementalMutableDefinitionStackMap(); + cElementalMutableDefinitionStackMap defs = new cElementalMutableDefinitionStackMap(); defs.putUnifyAll(in1.definition.getSubParticles()); defs.putUnify(in2.definition.getStackForm(1)); dAtomDefinition atom = new dAtomDefinition(defs.toImmutable_optimized_unsafeLeavesExposedElementalTree()); - out.putUnify(new cElementalInstanceStack(atom,Math.min(in1.amount,in2.amount))); - }catch (Exception e){ - out.putUnifyAll(in1,in2); + out.putUnify(new cElementalInstanceStack(atom, Math.min(in1.amount, in2.amount))); + } catch (Exception e) { + out.putUnifyAll(in1, in2); return; } - if(in1.amount>in2.amount){ - out.putUnify(new cElementalInstanceStack(in1.definition,in1.amount-in2.amount)); - }else if (in2.amount>in1.amount){ - out.putUnify(new cElementalInstanceStack(in2.definition,in2.amount-in1.amount)); + if (in1.amount > in2.amount) { + out.putUnify(new cElementalInstanceStack(in1.definition, in1.amount - in2.amount)); + } else if (in2.amount > in1.amount) { + out.putUnify(new cElementalInstanceStack(in2.definition, in2.amount - in1.amount)); } } @@ -268,9 +272,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //region parameters protected Parameters.Group.ParameterIn mode; - private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p)->{ - if(base_EM.isMaster()){ - double mode=p.get(); + private static final IStatusFunction<GT_MetaTileEntity_EM_collider> MODE_STATUS = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); if (mode == FUSE_MODE || mode == COLLIDE_MODE) { return STATUS_OK; } else if (mode > 1) { @@ -282,12 +286,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } return STATUS_UNUSED; }; - private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p)->{ - if(base_EM.isMaster()){ - double mode=p.get(); - if(mode==FUSE_MODE){ + private static final INameFunction<GT_MetaTileEntity_EM_collider> MODE_NAME = (base_EM, p) -> { + if (base_EM.isMaster()) { + double mode = p.get(); + if (mode == FUSE_MODE) { return "Mode: Fuse"; - }else if(mode==COLLIDE_MODE){ + } else if (mode == COLLIDE_MODE) { return "Mode: Collide"; } return "Mode: Undefined"; @@ -296,32 +300,32 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB }; //endregion - protected boolean started=false; + protected boolean started = false; //region Structure //use multi A energy inputs, use less power the longer it runs private static final String[][] shape = new String[][]{ - {"I0A0A0","I00000","I0A0A0",}, - {"H0000000","G001111100","H0000000",}, - {"F22223332222","F41155555114","F22223332222",}, - {"E2000000000002","E4155111115514","E2000000000002",}, - {"D20000E00002","D41511E11514","D20000E00002",}, - {"C2000I0002","C4151I1514","C2000I0002",}, - {"B2000K0002","B4151K1514","B2000K0002",}, - {"B200M002","A0151M1510","B200M002",}, - {"A0200M0020","A0151M1510","A0200M0020",}, - {"0020O0200","0151O1510","0020O0200",}, - {"A030O030","0151O1510","A030O030",}, - {"0030O0300","0151O1510","0030O0300",}, - {"A030O030","0151O1510","A030O030",}, - {"0020O0200","0151O1510","0020O0200",}, - {"A0200M0020","A0151M1510","A0200M0020",}, - {"B200M002","A0151M1510","B200M002",}, - {"B2000K0002","B4151K1514","B2000K0002",}, - {"C2000I0002","C4151I1514","C2000I0002",}, - {"D200002 200002","D415112 . 211514","D200002 200002",}, - {"E20!!22222!!02","E4155111115514","E20!!22222!!02",}, - {"F2222#\"#2222","F41155555114","F2222#\"#2222",}, + {"I0A0A0", "I00000", "I0A0A0",}, + {"H0000000", "G001111100", "H0000000",}, + {"F22223332222", "F41155555114", "F22223332222",}, + {"E2000000000002", "E4155111115514", "E2000000000002",}, + {"D20000E00002", "D41511E11514", "D20000E00002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0030O0300", "0151O1510", "0030O0300",}, + {"A030O030", "0151O1510", "A030O030",}, + {"0020O0200", "0151O1510", "0020O0200",}, + {"A0200M0020", "A0151M1510", "A0200M0020",}, + {"B200M002", "A0151M1510", "B200M002",}, + {"B2000K0002", "B4151K1514", "B2000K0002",}, + {"C2000I0002", "C4151I1514", "C2000I0002",}, + {"D200002 200002", "D415112 . 211514", "D200002 200002",}, + {"E20!!22222!!02", "E4155111115514", "E20!!22222!!02",}, + {"F2222#\"#2222", "F41155555114", "F2222#\"#2222",}, }; private static final Block[] blockType = new Block[]{ sBlockCasingsTT, @@ -342,7 +346,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic Hatches or High Power Casing", "2 - Elemental Input Hatches or Molecular Casing", "3 - Elemental Output Hatches or Molecular Casing", @@ -361,8 +365,8 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override protected void parametersInstantiation_EM() { - Parameters.Group hatch_0=parametrization.getGroup(0); - mode=hatch_0.makeInParameter(0,FUSE_MODE, MODE_NAME, MODE_STATUS); + Parameters.Group hatch_0 = parametrization.getGroup(0); + mode = hatch_0.makeInParameter(0, FUSE_MODE, MODE_NAME, MODE_STATUS); } @Override @@ -383,9 +387,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - if(aFacing%2==0){ + if (aFacing % 2 == 0) { return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; - }else{ + } else { return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][4], new TT_RenderedTexture(aActive ? ScreenON_Slave : ScreenOFF_Slave)}; } } @@ -396,28 +400,28 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setByte("eTier", eTier);//collider tier - aNBT.setBoolean("eStarted",started); - if(stack!=null) { + aNBT.setBoolean("eStarted", started); + if (stack != null) { aNBT.setTag("eStack", stack.toNBT()); } - aNBT.setLong("ePlasmaEnergy",plasmaEnergy); + aNBT.setLong("ePlasmaEnergy", plasmaEnergy); } @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")); + started = aNBT.getBoolean("eStarted"); + if (aNBT.hasKey("eStack")) { + stack = cElementalInstanceStack.fromNBT(aNBT.getCompoundTag("eStack")); } - plasmaEnergy=aNBT.getLong("ePlasmaEnergy"); + plasmaEnergy = aNBT.getLong("ePlasmaEnergy"); } @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX*2; - int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ*2; + int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX * 2; + int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ * 2; if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { eTier = 0; return false; @@ -453,51 +457,51 @@ 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){ + 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); + 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); + StructureBuilderExtreme(shape, blockType, blockMeta1, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); } else { - StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity,this, hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta2, 11, 1, 18, iGregTechTileEntity, this, hintsOnly); } } @Override public void parametersStatusesWrite_EM(boolean machineBusy) { - if(isMaster()) { + if (isMaster()) { super.parametersStatusesWrite_EM(machineBusy); } } @Override public boolean checkRecipe_EM(ItemStack itemStack) { - GT_MetaTileEntity_EM_collider partner=getPartner(); - if(partner==null){ + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { return false; } - mEfficiencyIncrease=10000; - if(started) { - if(stack==null) { + mEfficiencyIncrease = 10000; + if (started) { + if (stack == null) { for (GT_MetaTileEntity_Hatch_InputElemental inputElemental : eInputHatches) { cElementalInstanceStackMap container = inputElemental.getContainerHandler(); if (container.isEmpty()) { continue; } stack = container.remove(container.getFirst().definition); - long eut = KEEPUP_COST+(long)(KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass()))/2; + long eut = KEEPUP_COST + (long) (KEEPUP_COST * Math.abs(stack.getMass() / dAtomDefinition.getSomethingHeavy().getMass())) / 2; if (eut < Integer.MIN_VALUE + 7) { return false; } @@ -515,18 +519,18 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB mEUt = KEEPUP_COST; eAmpereFlow = 2; return true; - }else{ - started=true; - mMaxProgresstime=20; - mEUt=STARTUP_COST; - eAmpereFlow=10; + } else { + started = true; + mMaxProgresstime = 20; + mEUt = STARTUP_COST; + eAmpereFlow = 10; return true; } } - 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()) && + 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; @@ -558,11 +562,11 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB } private boolean handleRecipe(cElementalInstanceStack stack2, cElementalInstanceStackMap map, IColliderHandler colliderHandler) { - if (colliderHandler != null && eTier>= colliderHandler.getRequiredTier()) { + if (colliderHandler != null && eTier >= colliderHandler.getRequiredTier()) { colliderHandler.collide(stack2, stack, map); } else { - map.putUnifyAll(stack,stack2); - outputEM=new cElementalInstanceStackMap[]{map}; + map.putUnifyAll(stack, stack2); + outputEM = new cElementalInstanceStackMap[]{map}; return true; } return false; @@ -570,10 +574,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override protected void afterRecipeCheckFailed() { - started=false; - if(stack!=null){ + started = false; + if (stack != null) { cleanMassEM_EM(stack.getMass()); - stack=null; + stack = null; } getBaseMetaTileEntity().disableWorking(); super.afterRecipeCheckFailed(); @@ -581,29 +585,29 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB @Override public void stopMachine() { - started=false; - if(stack!=null){ + started = false; + if (stack != null) { cleanMassEM_EM(stack.getMass()); - stack=null; + stack = null; } super.stopMachine(); } @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if(!aBaseMetaTileEntity.isAllowedToWork()){ - started=false; + 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) { + 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 && @@ -613,22 +617,22 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB return null; } - protected final boolean isMaster(){ - return getBaseMetaTileEntity().getFrontFacing()%2==0; + protected final boolean isMaster() { + return getBaseMetaTileEntity().getFrontFacing() % 2 == 0; } @Override - public void outputAfterRecipe_EM(){ - GT_MetaTileEntity_EM_collider partner=getPartner(); - if(partner==null){ - if(stack!=null){ + public void outputAfterRecipe_EM() { + GT_MetaTileEntity_EM_collider partner = getPartner(); + if (partner == null) { + if (stack != null) { cleanMassEM_EM(stack.getMass()); - stack=null; + stack = null; } return; } if (isMaster()) { - switch ((int)mode.get()){ + switch ((int) mode.get()) { case FUSE_MODE: makeEU(fuse(partner)); break; @@ -636,43 +640,43 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB //collide(partner);//todo break; default: { - outputEM=new cElementalInstanceStackMap[2]; - outputEM[1]=tickStack(); - if(outputEM[1]==null){ - outputEM[1]=partner.tickStack(); - }else { - cElementalInstanceStackMap map=partner.tickStack(); - if(map!=null){ + outputEM = new cElementalInstanceStackMap[2]; + outputEM[1] = tickStack(); + if (outputEM[1] == null) { + outputEM[1] = partner.tickStack(); + } else { + cElementalInstanceStackMap map = partner.tickStack(); + if (map != null) { outputEM[1].putUnifyAll(map); } } } } - if(outputEM!=null) { - for(int i=0,lim=Math.min(outputEM.length,eOutputHatches.size());i<lim;i++){ - if(outputEM[i]!=null) { + if (outputEM != null) { + for (int i = 0, lim = Math.min(outputEM.length, eOutputHatches.size()); i < lim; i++) { + if (outputEM[i] != null) { eOutputHatches.get(i).getContainerHandler().putUnifyAll(outputEM[i]); - outputEM[i]=null; + outputEM[i] = null; } } } } } - private void makeEU(double massDiff){ - plasmaEnergy+=massDiff*MASS_TO_EU_INSTANT; + private void makeEU(double massDiff) { + plasmaEnergy += massDiff * MASS_TO_EU_INSTANT; System.out.println("plasmaEnergy = " + plasmaEnergy); } - private cElementalInstanceStackMap tickStack(){ - if(stack==null){ + 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); + stack = newInstances.remove(newInstances.getLast().definition); } return newInstances; } @@ -690,4 +694,4 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Faster than light*!!!" }; } -} +}
\ 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 13bdc4976d..b05653fb33 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 @@ -33,6 +33,7 @@ import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texturePage; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static net.minecraft.util.StatCollector.translateToLocal; public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { private final ArrayList<GT_MetaTileEntity_Hatch_OutputDataItems> eStacksDataOutputs = new ArrayList<>(); @@ -40,20 +41,20 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB //region Structure private static final String[][] shape = new String[][]{ - {"0 0","0 . 0","0 0",}, - {"0!!!0","01110","0!!!0",}, - {"0!!!0","0!!!0","0!!!0",}, + {"0 0", "0 . 0", "0 0",}, + {"0!!!0", "01110", "0!!!0",}, + {"0!!!0", "0!!!0", "0!!!0",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{2,1}; - private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList,this::addDataBankHatchToMachineList}; - private static final short[] casingTextures = new short[]{textureOffset,textureOffset+1}; - private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; - private static final byte[] blockMetaFallback = new byte[]{0,1}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{2, 1}; + private final IHatchAdder[] addingMethods = new IHatchAdder[]{this::addClassicToMachineList, this::addDataBankHatchToMachineList}; + private static final short[] casingTextures = new short[]{textureOffset, textureOffset + 1}; + private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMetaFallback = new byte[]{0, 1}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or high power casing", - "2 - Data Access/Data Bank Master Hatches or computer casing", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.databank.hint.0"),//1 - Classic Hatches or high power casing + translateToLocal("gt.blockmachines.multimachine.em.databank.hint.1"),//2 - Data Access/Data Bank Master Hatches or computer casing }; //endregion @@ -65,11 +66,11 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB super(aName); } - public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_hi_freq"); + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_hi_freq"); @Override @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ + protected ResourceLocation getActivitySound() { return activitySound; } @@ -105,7 +106,7 @@ 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); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override @@ -116,8 +117,8 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public boolean checkRecipe_EM(ItemStack itemStack) { if (eDataAccessHatches.size() > 0 && eStacksDataOutputs.size() > 0) { - mEUt = -(int)V[4]; - eAmpereFlow = 1 + eStacksDataOutputs.size()*eDataAccessHatches.size(); + mEUt = -(int) V[4]; + eAmpereFlow = 1 + eStacksDataOutputs.size() * eDataAccessHatches.size(); mMaxProgresstime = 20; mEfficiencyIncrease = 10000; return true; @@ -127,24 +128,24 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { - ArrayList<ItemStack> stacks=new ArrayList<>(); - for(GT_MetaTileEntity_Hatch_DataAccess dataAccess:eDataAccessHatches){ - int count=dataAccess.getSizeInventory(); - for(int i=0;i<count;i++){ - ItemStack stack=dataAccess.getStackInSlot(i); - if(stack!=null){ + ArrayList<ItemStack> stacks = new ArrayList<>(); + for (GT_MetaTileEntity_Hatch_DataAccess dataAccess : eDataAccessHatches) { + int count = dataAccess.getSizeInventory(); + for (int i = 0; i < count; i++) { + ItemStack stack = dataAccess.getStackInSlot(i); + if (stack != null) { stacks.add(stack); } } } - if(stacks.size()>0){ - ItemStack[] arr=stacks.toArray(nullItem); - for(GT_MetaTileEntity_Hatch_OutputDataItems hatch:eStacksDataOutputs){ - hatch.q=new InventoryDataPacket(arr); + if (stacks.size() > 0) { + ItemStack[] arr = stacks.toArray(nullItem); + for (GT_MetaTileEntity_Hatch_OutputDataItems hatch : eStacksDataOutputs) { + hatch.q = new InventoryDataPacket(arr); } - }else{ - for(GT_MetaTileEntity_Hatch_OutputDataItems hatch:eStacksDataOutputs){ - hatch.q=null; + } else { + for (GT_MetaTileEntity_Hatch_OutputDataItems hatch : eStacksDataOutputs) { + hatch.q = null; } } } @@ -153,8 +154,8 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Remote assembly data delivery", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Apply directly to the forehead" + translateToLocal("gt.blockmachines.multimachine.em.databank.desc.0"),//Remote assembly data delivery + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.databank.desc.1")//Apply directly to the forehead }; } @@ -170,10 +171,10 @@ public class GT_MetaTileEntity_EM_dataBank extends GT_MetaTileEntity_MultiblockB if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_OutputDataItems) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return eStacksDataOutputs.add((GT_MetaTileEntity_Hatch_OutputDataItems) aMetaTileEntity); - }else if(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess && !(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputDataItems)){ + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_DataAccess && !(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_InputDataItems)) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); return eDataAccessHatches.add((GT_MetaTileEntity_Hatch_DataAccess) 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_dequantizer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/GT_MetaTileEntity_EM_dequantizer.java index 011105356a..e682c77702 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 @@ -31,6 +31,7 @@ import static com.github.technus.tectech.mechanics.elementalMatter.definitions.c import static com.github.technus.tectech.mechanics.elementalMatter.definitions.complex.dAtomDefinition.refUnstableMass; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.12.2016. @@ -55,10 +56,10 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA + "Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input Hatch", - "3 - Elemental Overflow Hatches or Molecular Casing", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.0"),//1 - Classic Hatches or High Power Casing" + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.1"),//2 - Elemental Input Hatch + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; //endregion @@ -72,7 +73,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo @Override @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ + protected ResourceLocation getActivitySound() { return GT_MetaTileEntity_EM_quantizer.activitySound; } @@ -88,7 +89,7 @@ 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); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override @@ -105,7 +106,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo if (info != null) { if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { mOutputFluids = new FluidStack[]{(FluidStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); + startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); return true; } } @@ -114,7 +115,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo if (info != null) { if (map.removeAllAmounts(false, (iHasElementalDefinition) info.input())) { mOutputItems = new ItemStack[]{(ItemStack) info.output()}; - startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); + startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); return true; } } @@ -125,7 +126,7 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo ArrayList<ItemStack> items = OreDictionary.getOres(((aOredictDequantizationInfo) info).out); if (items != null && !items.isEmpty()) { mOutputItems = new ItemStack[]{items.get(0)}; - startRecipe((iHasElementalDefinition) info.input(),stack.getEnergy()); + startRecipe((iHasElementalDefinition) info.input(), stack.getEnergy()); return true; } } @@ -152,8 +153,8 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Transform quantum form back to...", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "regular one, but why?" + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.desc.0"),//Transform quantum form back to... + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + translateToLocal("gt.blockmachines.multimachine.em.emtomatter.desc.1")//regular one, but why? }; } -} +}
\ 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 337afd4f32..9d431e3bc3 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 @@ -22,6 +22,7 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.base.LedStatus.*; import static gregtech.api.enums.GT_Values.E; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.12.2016. @@ -42,38 +43,38 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB {"A!!!", "!000!", "!000!", "!000!", "A!!!",}, {"A!!!", "!!!!!", "!!!!!", "!!!!!", "A!!!",}, }; - private static final Block[] blockType = new Block[]{sBlockCasingsTT,sBlockCasingsTT}; - private static final byte[] blockMeta = new byte[]{4,5}; + private static final Block[] blockType = new Block[]{sBlockCasingsTT, sBlockCasingsTT}; + private static final byte[] blockMeta = new byte[]{4, 5}; 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:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Hatches or Molecular Casing", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.junction.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.junction.hint.1"),//2 - Elemental Hatches or Molecular Casing }; //endregion //region parameters - private static final INameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME= - (base,p)->(p.parameterId()==0?"Source ":"Destination ")+p.hatchId(); + private static final INameFunction<GT_MetaTileEntity_EM_junction> ROUTE_NAME = + (base, p) -> (p.parameterId() == 0 ? translateToLocal("tt.keyword.Source") + " " : translateToLocal("tt.keyword.Destination") + " ") + p.hatchId(); private static final IStatusFunction<GT_MetaTileEntity_EM_junction> SRC_STATUS = - (base,p)-> { + (base, p) -> { double v = p.get(); if (Double.isNaN(v)) return STATUS_WRONG; - v=(int)v; + v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_NEUTRAL; if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; return STATUS_OK; }; private static final IStatusFunction<GT_MetaTileEntity_EM_junction> DST_STATUS = - (base,p)->{ - if(base.src[p.hatchId()].getStatus(false)== STATUS_OK){ + (base, p) -> { + if (base.src[p.hatchId()].getStatus(false) == STATUS_OK) { double v = p.get(); if (Double.isNaN(v)) return STATUS_WRONG; - v=(int)v; + v = (int) v; if (v < 0) return STATUS_TOO_LOW; if (v == 0) return STATUS_LOW; if (v >= base.eInputHatches.size()) return STATUS_TOO_HIGH; @@ -95,8 +96,8 @@ 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]; + 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); @@ -111,10 +112,10 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - int meta=iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); - if(meta==4){ + int meta = iGregTechTileEntity.getMetaIDAtSide(GT_Utility.getOppositeSide(iGregTechTileEntity.getFrontFacing())); + if (meta == 4) { return structureCheck_EM(shape, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 1, 1, 0); - }else if(meta==5){ + } else if (meta == 5) { return structureCheck_EM(shapeBig, blockType, blockMeta, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 2, 2, 0); } return false; @@ -122,7 +123,7 @@ 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); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override @@ -134,8 +135,8 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Reroutes Matter", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "Axis aligned movement!" + 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! }; } @@ -155,18 +156,18 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { - double src,dst; + double src, dst; for (int i = 0; i < 10; i++) { - src= this.src[i].get(); - dst= this.dst[i].get(); - if(Double.isNaN(src) || Double.isNaN(dst)) { + src = this.src[i].get(); + dst = this.dst[i].get(); + if (Double.isNaN(src) || Double.isNaN(dst)) { continue; } - int inIndex = (int)src - 1; + int inIndex = (int) src - 1; if (inIndex < 0 || inIndex >= eInputHatches.size()) { continue; } - int outIndex = (int)dst - 1; + int outIndex = (int) dst - 1; GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); @@ -180,4 +181,4 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB } } } -} +}
\ 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 7f983b798c..ee327bed51 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 @@ -40,6 +40,7 @@ import static com.github.technus.tectech.recipe.TT_recipeAdder.nullFluid; import static com.github.technus.tectech.recipe.TT_recipeAdder.nullItem; import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.textureOffset; import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.12.2016. @@ -63,10 +64,10 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Output Hatch", - "3 - Elemental Overflow Hatches or Molecular Casing", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.1"),//2 - Elemental Output Hatch + translateToLocal("gt.blockmachines.multimachine.em.mattertoem.hint.2"),//3 - Elemental Overflow Hatches or Molecular Casing }; //endregion @@ -78,11 +79,11 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock super(aName); } - public final static ResourceLocation activitySound=new ResourceLocation(Reference.MODID+":fx_mid_freq"); + public final static ResourceLocation activitySound = new ResourceLocation(Reference.MODID + ":fx_mid_freq"); @Override @SideOnly(Side.CLIENT) - protected ResourceLocation getActivitySound(){ + protected ResourceLocation getActivitySound() { return activitySound; } @@ -98,7 +99,7 @@ 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); + StructureBuilderExtreme(shape, blockType, blockMeta, 1, 1, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override @@ -110,8 +111,8 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "Conveniently convert regular stuff into quantum form.", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "To make it more inconvenient." + 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. }; } @@ -204,4 +205,4 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock eOutputHatches.get(0).getContainerHandler().putUnifyAll(outputEM[0]); outputEM = null; } -} +}
\ 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 11be32f9a5..0a2e06ac7d 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 @@ -42,6 +42,7 @@ import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBloc import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; import static gregtech.api.enums.GT_Values.E; +import static net.minecraft.util.StatCollector.translateToLocal; /** * Created by danie_000 on 17.12.2016. @@ -71,7 +72,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+"Hint Details:", + EnumChatFormatting.AQUA+translateToLocal("tt.keyphrase.Hint_Details") + ":", "1 - Classic/Data Hatches or Computer casing", "2 - Holder Hatch", }; 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 96132a889e..a7f4c84f41 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 @@ -45,15 +45,16 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture import static com.github.technus.tectech.thing.casing.TT_Container_Casings.sBlockCasingsTT; import static com.github.technus.tectech.thing.metaTileEntity.multi.GT_MetaTileEntity_EM_crafting.crafter; import static com.github.technus.tectech.thing.metaTileEntity.multi.em_machine.GT_MetaTileEntity_EM_machine.machine; +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 { - 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, - SCAN_GET_COLOR=256,SCAN_GET_AGE=512,SCAN_GET_TIMESPAN_MULT=1024,SCAN_GET_CLASS_TYPE=2048; + 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, + SCAN_GET_COLOR = 256, SCAN_GET_AGE = 512, SCAN_GET_TIMESPAN_MULT = 1024, SCAN_GET_CLASS_TYPE = 2048; private TT_recipe.TT_EMRecipe.TT_EMRecipe eRecipe; private cElementalDefinitionStack objectResearched; @@ -63,18 +64,18 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa 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)){ + 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; + 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; @@ -102,31 +103,31 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa private static final Block[] blockTypeFallback = new Block[]{sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT, sBlockCasingsTT}; private static final byte[] blockMetaFallback = new byte[]{0, 4, 4, 4}; private static final String[] description = new String[]{ - EnumChatFormatting.AQUA+"Hint Details:", - "1 - Classic Hatches or High Power Casing", - "2 - Elemental Input Hatches or Molecular Casing", - "3 - Elemental Output Hatches or Molecular Casing", - "4 - Elemental Overflow Hatches or Molecular Casing", + EnumChatFormatting.AQUA + translateToLocal("tt.keyphrase.Hint_Details") + ":", + translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.0"),//1 - Classic Hatches or High Power Casing + translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.1"),//2 - Elemental Input Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.2"),//3 - Elemental Output Hatches or Molecular Casing + translateToLocal("gt.blockmachines.multimachine.em.scanner.hint.3"),//4 - Elemental Overflow Hatches or Molecular Casing }; //endregion public GT_MetaTileEntity_EM_scanner(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); - eDismantleBoom=true; + eDismantleBoom = true; } public GT_MetaTileEntity_EM_scanner(String aName) { super(aName); - eDismantleBoom=true; + eDismantleBoom = true; } @Override protected void parametersInstantiation_EM() { - scanConfiguration=new Parameters.Group.ParameterIn[20]; + 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); + scanConfiguration[i * 2] = hatch.makeInParameter(0, 0, CONFIG_NAME, CONFIG_STATUS); + scanConfiguration[i * 2 + 1] = hatch.makeInParameter(1, 0, CONFIG_NAME, CONFIG_STATUS); } } @@ -145,7 +146,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void construct(int stackSize, boolean hintsOnly) { - StructureBuilderExtreme(shape, blockType, blockMeta,2, 2, 0, getBaseMetaTileEntity(),this,hintsOnly); + StructureBuilderExtreme(shape, blockType, blockMeta, 2, 2, 0, getBaseMetaTileEntity(), this, hintsOnly); } @Override @@ -157,8 +158,8 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa public String[] getDescription() { return new String[]{ CommonValues.TEC_MARK_EM, - "What is existing here?", - EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + "I HAVE NO IDEA (yet)!" + "",//What is existing here? + EnumChatFormatting.AQUA.toString() + EnumChatFormatting.BOLD + ""//I HAVE NO IDEA (yet)! }; } @@ -167,17 +168,17 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa super.saveNBTData(aNBT); aNBT.setLong("eComputationRemaining", totalComputationRemaining); aNBT.setLong("eComputationRequired", totalComputationRequired); - if(objectResearched!=null) { + if (objectResearched != null) { aNBT.setTag("eObject", objectResearched.toNBT()); } else { aNBT.removeTag("eObject"); } - if(scanComplexity!=null) { + if (scanComplexity != null) { aNBT.setIntArray("eScanComplexity", scanComplexity); } else { aNBT.removeTag("eScanComplexity"); } - if(objectsScanned!=null) { + if (objectsScanned != null) { aNBT.setTag("eScanObjects", objectsScanned.toNBT()); } else { aNBT.removeTag("eScanObjects"); @@ -187,17 +188,17 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - totalComputationRemaining =aNBT.getLong("eComputationRemaining"); - totalComputationRequired =aNBT.getLong("eComputationRequired"); - if(aNBT.hasKey("eObject")) { + totalComputationRemaining = aNBT.getLong("eComputationRemaining"); + totalComputationRequired = aNBT.getLong("eComputationRequired"); + if (aNBT.hasKey("eObject")) { objectResearched = cElementalDefinitionStack.fromNBT(aNBT.getCompoundTag("eObject")); - if(objectResearched.definition==nbtE__) { + if (objectResearched.definition == nbtE__) { objectResearched = null; } - }else { + } else { objectResearched = null; } - if(aNBT.hasKey("eScanComplexity")) { + if (aNBT.hasKey("eScanComplexity")) { scanComplexity = aNBT.getIntArray("eScanComplexity"); } else { scanComplexity = null; @@ -206,25 +207,25 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (aNBT.hasKey("eScanObjects")) { objectsScanned = cElementalInstanceStackMap.fromNBT(aNBT.getCompoundTag("eScanObjects")); } - }catch (tElementalException e){ - objectsScanned=new cElementalInstanceStackMap(); + } catch (tElementalException e) { + objectsScanned = new cElementalInstanceStackMap(); } } @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); + 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 void onFirstTick_EM(IGregTechTileEntity aBaseMetaTileEntity) { - if(aBaseMetaTileEntity.isServerSide()) { - if (totalComputationRemaining > 0 && objectResearched!=null) { + 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); @@ -240,7 +241,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa if (eRecipe == null) { quantumStuff(false); objectResearched = null; - eRequiredData=0; + eRequiredData = 0; totalComputationRequired = totalComputationRemaining = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; @@ -253,27 +254,27 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { - eRecipe=null; - if(!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { + eRecipe = null; + if (!eInputHatches.isEmpty() && eInputHatches.get(0).getContainerHandler().hasStacks() && !eOutputHatches.isEmpty()) { cElementalInstanceStackMap researchEM = eInputHatches.get(0).getContainerHandler(); - if(ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { - GT_Recipe scannerRecipe=null; - for(cElementalInstanceStack stackEM:researchEM.values()){ - objectsScanned=null; + if (ItemList.Tool_DataOrb.isStackEqual(itemStack, false, true)) { + GT_Recipe scannerRecipe = null; + for (cElementalInstanceStack stackEM : researchEM.values()) { + objectsScanned = null; eRecipe = TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.findRecipe(stackEM.definition); - if(eRecipe!=null) { - scannerRecipe=eRecipe.scannerRecipe; - machineType= machine; - objectResearched=new cElementalDefinitionStack(stackEM.definition,1); + if (eRecipe != null) { + scannerRecipe = eRecipe.scannerRecipe; + machineType = machine; + objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); //cleanMassEM_EM(objectResearched.getMass()); researchEM.remove(objectResearched.definition); break; } eRecipe = TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.findRecipe(stackEM.definition); - if(eRecipe!=null) { - scannerRecipe=eRecipe.scannerRecipe; - machineType= crafter; - objectResearched=new cElementalDefinitionStack(stackEM.definition,1); + if (eRecipe != null) { + scannerRecipe = eRecipe.scannerRecipe; + machineType = crafter; + objectResearched = new cElementalDefinitionStack(stackEM.definition, 1); //cleanMassEM_EM(objectResearched.getMass()); researchEM.remove(objectResearched.definition); break; @@ -281,7 +282,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa cleanStackEM_EM(stackEM); researchEM.remove(stackEM.definition); } - if(eRecipe!=null && scannerRecipe!=null){//todo make sure it werks + if (eRecipe != null && scannerRecipe != null) {//todo make sure it werks totalComputationRequired = totalComputationRemaining = scannerRecipe.mDuration * 20L; mMaxProgresstime = 20;//const mEfficiencyIncrease = 10000; @@ -291,39 +292,39 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa quantumStuff(true); return true; } - }else if(CustomItemList.scanContainer.isStackEqual(itemStack, false, true)) { - eRecipe=null; - if(researchEM.hasStacks()) { + } else if (CustomItemList.scanContainer.isStackEqual(itemStack, false, true)) { + eRecipe = null; + if (researchEM.hasStacks()) { objectsScanned = researchEM.takeAllToNewMap(); cleanMassEM_EM(objectsScanned.getMass()); - totalComputationRequired =0; - eRequiredData=0; - eAmpereFlow=objectsScanned.size() + TecTech.RANDOM.next(objectsScanned.size()); - mEUt=-(int)V[8]; + totalComputationRequired = 0; + eRequiredData = 0; + eAmpereFlow = objectsScanned.size() + TecTech.RANDOM.next(objectsScanned.size()); + mEUt = -(int) V[8]; //get depth scan complexity array { int[] scanComplexityTemp = new int[20]; for (int i = 0; i < 20; i++) { - scanComplexityTemp[i]=(int)scanConfiguration[i].get(); + scanComplexityTemp[i] = (int) scanConfiguration[i].get(); } int maxDepth = 0; for (int i = 0; i < 20; i++) { if (scanComplexityTemp[i] != SCAN_DO_NOTHING) { maxDepth = i; - if(!DEBUG_MODE) { + if (!DEBUG_MODE) { scanComplexityTemp[i] &= ~SCAN_GET_CLASS_TYPE; } - addComputationRequirements(i+1,scanComplexityTemp[i]); + addComputationRequirements(i + 1, scanComplexityTemp[i]); } } - maxDepth+=1;//from index to len + maxDepth += 1;//from index to len scanComplexity = new int[maxDepth]; - System.arraycopy(scanComplexityTemp,0,scanComplexity,0,maxDepth); + System.arraycopy(scanComplexityTemp, 0, scanComplexity, 0, maxDepth); } - totalComputationRemaining = totalComputationRequired*=20; + totalComputationRemaining = totalComputationRequired *= 20; mMaxProgresstime = 20;//const mEfficiencyIncrease = 10000; quantumStuff(true); @@ -332,96 +333,96 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } } quantumStuff(false); - objectResearched=null; - totalComputationRemaining =0; + objectResearched = null; + totalComputationRemaining = 0; return false; } - private void addComputationRequirements(int depthPlus, int capabilities){ - if(areBitsSet(SCAN_GET_NOMENCLATURE,capabilities)){ - totalComputationRequired +=depthPlus*5L; - eRequiredData+=depthPlus; + 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_DEPTH_LEVEL, capabilities)) { + totalComputationRequired += depthPlus * 10L; + eRequiredData += depthPlus; } - if(areBitsSet(SCAN_GET_AMOUNT,capabilities)){ - totalComputationRequired +=depthPlus*64L; - eRequiredData+=depthPlus*8L; + 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_CHARGE, capabilities)) { + totalComputationRequired += depthPlus * 128L; + eRequiredData += depthPlus * 4L; } - if(areBitsSet(SCAN_GET_MASS,capabilities)){ - totalComputationRequired +=depthPlus*256L; - 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_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_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_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_COLOR, capabilities)) { + totalComputationRequired += depthPlus * 1024L; + eRequiredData += depthPlus * 48L; } - if(areBitsSet(SCAN_GET_AGE,capabilities)){ - totalComputationRequired +=depthPlus*2048L; - eRequiredData+=depthPlus*64L; + 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; + 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; + if (totalComputationRemaining <= 0) { + totalComputationRemaining = 0; + mProgresstime = mMaxProgresstime; return true; - }else{ - totalComputationRemaining -=eAvailableData; - mProgresstime=1; + } 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)){ + if (eRecipe != null && ItemList.Tool_DataOrb.isStackEqual(mInventory[1], false, true)) { - mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(eRecipe.mOutputs[0].getDisplayName()) + ' ' + machineType +" Construction Data"); + mInventory[1].setStackDisplayName(GT_LanguageManager.getTranslation(eRecipe.mOutputs[0].getDisplayName()) + ' ' + machineType + " Construction Data"); NBTTagCompound tNBT = mInventory[1].getTagCompound();//code above makes it not null tNBT.setString("eMachineType", machineType); tNBT.setTag(E_RECIPE_ID, objectResearched.toNBT()); - tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType+ " EM Recipe Generator"); - }else if(objectsScanned!=null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)){ - ElementalDefinitionScanStorage_EM.setContent(mInventory[1],objectsScanned,scanComplexity); + tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + ' ' + machineType + " EM Recipe Generator"); + } else if (objectsScanned != null && CustomItemList.scanContainer.isStackEqual(mInventory[1], false, true)) { + ElementalDefinitionScanStorage_EM.setContent(mInventory[1], objectsScanned, scanComplexity); } - objectResearched=null; - totalComputationRemaining =0; + objectResearched = null; + totalComputationRemaining = 0; quantumStuff(false); } @@ -460,7 +461,7 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa " 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+" / "+EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, + "Computation Available: " + EnumChatFormatting.GREEN + eAvailableData + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + eRequiredData + EnumChatFormatting.RESET, "Computation Remaining:", EnumChatFormatting.GREEN + Long.toString(totalComputationRemaining / 20L) + EnumChatFormatting.RESET + " / " + EnumChatFormatting.YELLOW + totalComputationRequired / 20L @@ -477,20 +478,20 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa public void stopMachine() { quantumStuff(false); super.stopMachine(); - totalComputationRequired = totalComputationRemaining =0; - objectResearched=null; + totalComputationRequired = totalComputationRemaining = 0; + objectResearched = null; } - 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(); + 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) { + if (block != null && block.getMaterial() == Material.air) { base.getWorld().setBlock(xDir, yDir, zDir, QuantumStuffBlock.INSTANCE, 0, 2); } } else { @@ -500,4 +501,4 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } } } -} +}
\ No newline at end of file |