diff options
author | Technus <daniel112092@gmail.com> | 2017-12-26 11:57:39 +0100 |
---|---|---|
committer | Technus <daniel112092@gmail.com> | 2017-12-26 11:57:39 +0100 |
commit | 347f653614c77072b1317b2cb0880284b55551a3 (patch) | |
tree | eba01c78c14791eac09f124894428a59961c011e /src/main | |
parent | 2969bb7b54e2a09859897af4312a74f91518e00f (diff) | |
download | GT5-Unofficial-347f653614c77072b1317b2cb0880284b55551a3.tar.gz GT5-Unofficial-347f653614c77072b1317b2cb0880284b55551a3.tar.bz2 GT5-Unofficial-347f653614c77072b1317b2cb0880284b55551a3.zip |
Code cleanup
Diffstat (limited to 'src/main')
108 files changed, 1331 insertions, 1249 deletions
diff --git a/src/main/java/com/github/technus/tectech/CommonValues.java b/src/main/java/com/github/technus/tectech/CommonValues.java index fb5b04f63d..0c49f98655 100644 --- a/src/main/java/com/github/technus/tectech/CommonValues.java +++ b/src/main/java/com/github/technus/tectech/CommonValues.java @@ -6,26 +6,26 @@ import net.minecraft.util.EnumChatFormatting; * Created by danie_000 on 11.01.2017. */ public final class CommonValues { - public final static String TEC_MARK_GENERAL = + public static final String TEC_MARK_GENERAL = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.BLUE + ": Interdimensional"; - public final static String TEC_MARK_EM = + public static final String TEC_MARK_EM = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.BLUE + ": Elemental Matter"; - public final static String BASS_MARK = + public static final String BASS_MARK = EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.BLUE + ": Theta Movement"; - public final static byte DECAY_AT = 0;// hatches compute decays - public final static byte MULTI_PURGE_1_AT = 2;// multiblocks clean their hatches 1 - public final static byte MOVE_AT = 4;// move stuff around - public final static byte RECIPE_AT = 6;// move stuff around - public final static byte MULTI_PURGE_2_AT = 8;// multiblocks clean their hatches 2 - public final static byte OVERFLOW_AT = 10;// then hatches clean themselves + public static final byte DECAY_AT = 0;// hatches compute decays + public static final byte MULTI_PURGE_1_AT = 2;// multiblocks clean their hatches 1 + public static final byte MOVE_AT = 4;// move stuff around + public static final byte RECIPE_AT = 6;// move stuff around + public static final byte MULTI_PURGE_2_AT = 8;// multiblocks clean their hatches 2 + public static final byte OVERFLOW_AT = 10;// then hatches clean themselves // - in case some hatches are not in multiblock structure - public final static byte MULTI_CHECK_AT = 12;// multiblock checks it's state - public final static byte DISPERSE_AT = 14;// overflow hatches perform disperse + public static final byte MULTI_CHECK_AT = 12;// multiblock checks it's state + public static final byte DISPERSE_AT = 14;// overflow hatches perform disperse } diff --git a/src/main/java/com/github/technus/tectech/TecTech.java b/src/main/java/com/github/technus/tectech/TecTech.java index adcaccdcb1..e82ab21895 100644 --- a/src/main/java/com/github/technus/tectech/TecTech.java +++ b/src/main/java/com/github/technus/tectech/TecTech.java @@ -7,8 +7,6 @@ import com.github.technus.tectech.loader.ModGuiHandler; import com.github.technus.tectech.proxy.CommonProxy; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; -import cpw.mods.fml.common.Mod.EventHandler; -import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.network.NetworkRegistry; @@ -35,15 +33,15 @@ public class TecTech { @SidedProxy(clientSide = Reference.CLIENTSIDE, serverSide = Reference.SERVERSIDE) public static CommonProxy proxy; - @Instance(Reference.MODID) + @Mod.Instance(Reference.MODID) public static TecTech instance; public static final XSTR Rnd = XSTR.XSTR_INSTANCE; public static final LogHelper Logger = new LogHelper(Reference.MODID); - private static IngameErrorLog Module_AdminErrorLogs = null; - public static MainLoader GTCustomLoader = null; + private static IngameErrorLog Module_AdminErrorLogs; + public static MainLoader GTCustomLoader; public static TecTechConfig ModConfig; - public static CreativeTabs mainTab = null; + public static CreativeTabs mainTab; public static boolean hasCOFH = false, hasThaumcraft = false; @@ -54,15 +52,14 @@ public class TecTech { Module_AdminErrorLogs.AddErrorLogOnAdminJoin(pMessage); } - @EventHandler + @Mod.EventHandler public void PreLoad(FMLPreInitializationEvent PreEvent) { Logger.setDebugOutput(true); ModConfig = new TecTechConfig(PreEvent.getModConfigurationDirectory(), Reference.COLLECTIONNAME, Reference.MODID); - if (!ModConfig.LoadConfig()) - Logger.error(Reference.MODID + " could not load its config file. Things are going to be weird!"); + if (!ModConfig.LoadConfig()) Logger.error(Reference.MODID + " could not load its config file. Things are going to be weird!"); if (ModConfig.ModAdminErrorLogs_Enabled) { Logger.debug("Module_AdminErrorLogs is enabled"); @@ -71,10 +68,10 @@ public class TecTech { GTCustomLoader = new MainLoader(); - TecTech.Logger.info("Added Atom Overrider"); + Logger.info("Added Atom Overrider"); } - @EventHandler + @Mod.EventHandler public void Load(FMLInitializationEvent event) { hasCOFH = Loader.isModLoaded(Reference.COFHCORE); hasThaumcraft = Loader.isModLoaded(Reference.THAUMCRAFT); @@ -86,18 +83,18 @@ public class TecTech { proxy.registerRenderInfo(); } - @EventHandler + @Mod.EventHandler public void PostLoad(FMLPostInitializationEvent PostEvent) { GTCustomLoader.postLoad(); if (ModConfig.NERF_FUSION) FixBrokenFusionRecipes(); fixBlocks(); } - @EventHandler + @Mod.EventHandler public void serverLoad(FMLServerStartingEvent pEvent) { } - @EventHandler + @Mod.EventHandler public void onServerAboutToStart(FMLServerAboutToStartEvent ev) { } @@ -107,14 +104,14 @@ public class TecTech { FluidStack p = m.getPlasma(1); if (p != null) { if (DEBUG_MODE) - TecTech.Logger.info("Found Plasma of " + m.mName); + Logger.info("Found Plasma of " + m.mName); if (m.mElement != null && (m.mElement.mProtons >= Materials.Iron.mElement.mProtons || -m.mElement.mProtons >= Materials.Iron.mElement.mProtons || m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons || -m.mElement.mNeutrons >= Materials.Iron.mElement.mNeutrons)) { if (DEBUG_MODE) - TecTech.Logger.info("Attempting to bind " + m.mName); + Logger.info("Attempting to bind " + m.mName); if (m.getMolten(1) != null) binds.put(p.getFluid(), m.getMolten(1).getFluid()); else if (m.getGas(1) != null) binds.put(p.getFluid(), m.getGas(1).getFluid()); else if (m.getFluid(1) != null) binds.put(p.getFluid(), m.getFluid(1).getFluid()); @@ -126,7 +123,7 @@ public class TecTech { Fluid f = binds.get(r.mFluidOutputs[0].getFluid()); if (f != null) { if (DEBUG_MODE) - TecTech.Logger.info("Nerfing Recipe " + r.mFluidOutputs[0].getUnlocalizedName()); + Logger.info("Nerfing Recipe " + r.mFluidOutputs[0].getUnlocalizedName()); r.mFluidOutputs[0] = new FluidStack(f, r.mFluidInputs[0].amount); } } diff --git a/src/main/java/com/github/technus/tectech/Util.java b/src/main/java/com/github/technus/tectech/Util.java index aa3f8eee1d..ff058d044d 100644 --- a/src/main/java/com/github/technus/tectech/Util.java +++ b/src/main/java/com/github/technus/tectech/Util.java @@ -75,7 +75,7 @@ public class Util { byte facing = aBaseMetaTileEntity.getFrontFacing(); int x, y, z, a, b, c, pointer; - final int + int baseX=aBaseMetaTileEntity.getXCoord(), baseZ=aBaseMetaTileEntity.getZCoord(), baseY=aBaseMetaTileEntity.getYCoord(); @@ -199,7 +199,7 @@ public class Util { IMetaTileEntity imt = aBaseMetaTileEntity.getMetaTileEntity(); int x, y, z, a, b, c, pointer; - final int + int baseX=aBaseMetaTileEntity.getXCoord(), baseZ=aBaseMetaTileEntity.getZCoord(), baseY=aBaseMetaTileEntity.getYCoord(); @@ -344,7 +344,7 @@ public class Util { //TE Rotation int x, y, z, a, b, c, pointer; - final int + int baseX=tileEntity.xCoord, baseZ=tileEntity.zCoord, baseY=tileEntity.yCoord; @@ -472,7 +472,7 @@ public class Util { ItemStack[] array = new ItemStack[10]; int x, y, z, a, b, c; - final int + int baseX=aBaseMetaTileEntity.getXCoord(), baseZ=aBaseMetaTileEntity.getZCoord(), baseY=aBaseMetaTileEntity.getYCoord(); @@ -533,7 +533,7 @@ public class Util { if (!block.hasTileEntity(meta) && block.getMaterial() != Material.air) { boolean err = true; - final ItemStack is = new ItemStack(block, 1, meta); + ItemStack is = new ItemStack(block, 1, meta); for (int i = 0; i < array.length; i++) { if (array[i] == null) { array[i] = is; @@ -730,7 +730,7 @@ public class Util { amt = tStack.stackSize; boolean temp = true; for (ItemStack aStack : givenInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { if (aDontCheckStackSizes) { temp = false; break; @@ -762,7 +762,6 @@ public class Util { aFluid.amount = 0; } else { aFluid.amount -= amt; - amt = 0; break; } } @@ -776,7 +775,7 @@ public class Util { if (tStack != null) { amt = tStack.stackSize; for (ItemStack aStack : givenInputs) { - if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) { + if (GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true)) { if (aDontCheckStackSizes) { aStack.stackSize -= amt; break; @@ -786,7 +785,6 @@ public class Util { aStack.stackSize = 0; } else { aStack.stackSize -= amt; - amt = 0; break; } } @@ -833,7 +831,7 @@ public class Util { } public static String[] infoFromNBT(NBTTagCompound nbt) { - final String[] strings = new String[nbt.getInteger("i")]; + String[] strings = new String[nbt.getInteger("i")]; for (int i = 0; i < strings.length; i++) strings[i] = nbt.getString(Integer.toString(i)); return strings; diff --git a/src/main/java/com/github/technus/tectech/Vec3pos.java b/src/main/java/com/github/technus/tectech/Vec3pos.java index b38a76ded5..30509d3f02 100644 --- a/src/main/java/com/github/technus/tectech/Vec3pos.java +++ b/src/main/java/com/github/technus/tectech/Vec3pos.java @@ -16,9 +16,9 @@ public class Vec3pos implements Comparable<Vec3pos> { } public Vec3pos(IGregTechTileEntity te) { - this.x = te.getXCoord(); - this.y = te.getYCoord(); - this.z = te.getZCoord(); + x = te.getXCoord(); + y = te.getYCoord(); + z = te.getZCoord(); } @Override diff --git a/src/main/java/com/github/technus/tectech/XSTR.java b/src/main/java/com/github/technus/tectech/XSTR.java index cb19449d85..af048bb19b 100644 --- a/src/main/java/com/github/technus/tectech/XSTR.java +++ b/src/main/java/com/github/technus/tectech/XSTR.java @@ -37,14 +37,13 @@ public class XSTR extends Random { private static final long serialVersionUID = 6208727693524452904L; private long seed; - private long last; private static final long GAMMA = 0x9e3779b97f4a7c15L; private static final int PROBE_INCREMENT = 0x9e3779b9; private static final long SEEDER_INCREMENT = 0xbb67ae8584caa73bL; private static final double DOUBLE_UNIT = 0x1.0p-53; // 1.0 / (1L << 53) private static final float FLOAT_UNIT = 0x1.0p-24f; // 1.0f / (1 << 24) private static final AtomicLong seedUniquifier = new AtomicLong(8682522807148012L); - public final static XSTR XSTR_INSTANCE=new XSTR(){ + public static final XSTR XSTR_INSTANCE=new XSTR(){ @Override public synchronized void setSeed(long seed) { if(!Thread.currentThread().getStackTrace()[2].getClassName().equals(Random.class.getName())) @@ -88,12 +87,14 @@ public class XSTR extends Random { this.seed = seed; } + @Override public boolean nextBoolean() { return next(1) != 0; } + @Override public double nextDouble() { - return (((long) (next(26)) << 27) + next(27)) * DOUBLE_UNIT; + return (((long) next(26) << 27) + next(27)) * DOUBLE_UNIT; } /** @@ -112,6 +113,7 @@ public class XSTR extends Random { * * @param seed the new seed */ + @Override public synchronized void setSeed(long seed) { this.seed = seed; } @@ -132,20 +134,22 @@ public class XSTR extends Random { * @param nbits * @return */ + @Override public int next(int nbits) { long x = seed; - x ^= (x << 21); - x ^= (x >>> 35); - x ^= (x << 4); + x ^= x << 21; + x ^= x >>> 35; + x ^= x << 4; seed = x; - x &= ((1L << nbits) - 1); + x &= (1L << nbits) - 1; return (int) x; } private boolean haveNextNextGaussian = false; private double nextNextGaussian = 0; - synchronized public double nextGaussian() { + @Override + public synchronized double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. if (haveNextNextGaussian) { haveNextNextGaussian = false; @@ -219,6 +223,7 @@ public class XSTR extends Random { * @throws IllegalArgumentException if bound is not positive * @since 1.2 */ + @Override public int nextInt(int bound) { //if (bound <= 0) { //throw new RuntimeException("BadBound"); @@ -237,27 +242,31 @@ public class XSTR extends Random { } return r;*/ //speedup, new nextInt ~+40% - last = seed ^ (seed << 21); - last ^= (last >>> 35); - last ^= (last << 4); + long last = seed ^ seed << 21; + last ^= last >>> 35; + last ^= last << 4; seed = last; int out = (int) last % bound; - return (out < 0) ? -out : out; + return out < 0 ? -out : out; } + @Override public int nextInt() { return next(32); } + @Override public float nextFloat() { return next(24) * FLOAT_UNIT; } + @Override public long nextLong() { // it's okay that the bottom word remains signed. - return ((long) (next(32)) << 32) + next(32); + return ((long) next(32) << 32) + next(32); } + @Override public void nextBytes(byte[] bytes_arr) { for (int iba = 0, lenba = bytes_arr.length; iba < lenba; ) for (int rndba = nextInt(), diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java index a66f51ff2d..30e310756d 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/EssentiaCompatEnabled.java @@ -25,20 +25,20 @@ public class EssentiaCompatEnabled extends EssentiaCompat { @Override public boolean check(GT_MetaTileEntity_MultiblockBase_EM meta) { TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); - return tile!=null && (tile instanceof TileEssentiaReservoir) || (tile instanceof TileJarFillable); + return tile!=null && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable; } @Override public TileEntity getContainer(GT_MetaTileEntity_MultiblockBase_EM meta) { TileEntity tile =meta.getBaseMetaTileEntity().getTileEntityAtSide(meta.getBaseMetaTileEntity().getBackFacing()); - return tile!=null && !tile.isInvalid() && (tile instanceof TileEssentiaReservoir) || (tile instanceof TileJarFillable)?tile:null; + return tile!=null && !tile.isInvalid() && tile instanceof TileEssentiaReservoir || tile instanceof TileJarFillable ?tile:null; } @Override public boolean putElementalInstanceStack(TileEntity container,cElementalInstanceStack stack){ if(container==null || container.isInvalid())return false; - if((container instanceof IAspectContainer) && (stack.definition instanceof iElementalAspect)){ - Aspect aspect=(Aspect)(((iElementalAspect) stack.definition).materializeIntoAspect()); + if(container instanceof IAspectContainer && stack.definition instanceof iElementalAspect){ + Aspect aspect=(Aspect) ((iElementalAspect) stack.definition).materializeIntoAspect(); if(aspect!=null){ ((IAspectContainer) container).addToContainer(aspect,1); return true; diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java index 210b88cb9e..6b46d47257 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/AspectDefinitionCompatEnabled.java @@ -13,20 +13,21 @@ import static com.github.technus.tectech.compatibility.thaumcraft.definitions.eP * Created by Tec on 21.05.2017. */ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat { + @Override public void run(){ - defToAspect.put(magic_air,"aer"); - defToAspect.put(magic_earth,"terra"); - defToAspect.put(magic_fire,"ignis"); - defToAspect.put(magic_water,"aqua"); - defToAspect.put(magic_order,"ordo"); - defToAspect.put(magic_entropy,"perditio"); + AspectDefinitionCompat.defToAspect.put(magic_air,"aer"); + AspectDefinitionCompat.defToAspect.put(magic_earth,"terra"); + AspectDefinitionCompat.defToAspect.put(magic_fire,"ignis"); + AspectDefinitionCompat.defToAspect.put(magic_water,"aqua"); + AspectDefinitionCompat.defToAspect.put(magic_order,"ordo"); + AspectDefinitionCompat.defToAspect.put(magic_entropy,"perditio"); - aspectToDef.put("aer",magic_air); - aspectToDef.put("terra",magic_earth); - aspectToDef.put("ignis",magic_fire); - aspectToDef.put("aqua",magic_water); - aspectToDef.put("ordo",magic_order); - aspectToDef.put("perditio",magic_entropy); + AspectDefinitionCompat.aspectToDef.put("aer",magic_air); + AspectDefinitionCompat.aspectToDef.put("terra",magic_earth); + AspectDefinitionCompat.aspectToDef.put("ignis",magic_fire); + AspectDefinitionCompat.aspectToDef.put("aqua",magic_water); + AspectDefinitionCompat.aspectToDef.put("ordo",magic_order); + AspectDefinitionCompat.aspectToDef.put("perditio",magic_entropy); ArrayList<Aspect> list=Aspect.getCompoundAspects(); Aspect[] array=list.toArray(new Aspect[0]); @@ -36,22 +37,18 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat Aspect[] content = aspect.getComponents(); if (content.length != 2) { list.remove(aspect); - }else if(aspectToDef.containsKey(content[0].getTag()) && - aspectToDef.containsKey(content[1].getTag())){ + }else if(AspectDefinitionCompat.aspectToDef.containsKey(content[0].getTag()) && AspectDefinitionCompat.aspectToDef.containsKey(content[1].getTag())){ try { dComplexAspectDefinition newAspect; if(content[0].getTag().equals(content[1].getTag())){ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(2) + newAspect = new dComplexAspectDefinition(AspectDefinitionCompat.aspectToDef.get(content[0].getTag()).getStackForm(2) ); }else{ - newAspect = new dComplexAspectDefinition( - aspectToDef.get(content[0].getTag()).getStackForm(1), - aspectToDef.get(content[1].getTag()).getStackForm(1) + newAspect = new dComplexAspectDefinition(AspectDefinitionCompat.aspectToDef.get(content[0].getTag()).getStackForm(1), AspectDefinitionCompat.aspectToDef.get(content[1].getTag()).getStackForm(1) ); } - aspectToDef.put(aspect.getTag(),newAspect); - defToAspect.put(newAspect,aspect.getTag()); + AspectDefinitionCompat.aspectToDef.put(aspect.getTag(),newAspect); + AspectDefinitionCompat.defToAspect.put(newAspect,aspect.getTag()); }catch (tElementalException e) { /**/ }finally { @@ -65,17 +62,17 @@ public final class AspectDefinitionCompatEnabled extends AspectDefinitionCompat @Override Aspect getAspect(cElementalDefinition definition) { - return Aspect.getAspect(defToAspect.get(definition)); + return Aspect.getAspect(AspectDefinitionCompat.defToAspect.get(definition)); } @Override String getAspectTag(cElementalDefinition definition) { - return defToAspect.get(definition); + return AspectDefinitionCompat.defToAspect.get(definition); } @Override iElementalDefinition getDefinition(String aspect) { - return aspectToDef.get(aspect); + return AspectDefinitionCompat.aspectToDef.get(aspect); } } diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java index 3084abb1f2..2afaf0e3f8 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/dComplexAspectDefinition.java @@ -56,7 +56,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme private dComplexAspectDefinition(boolean check, cElementalDefinitionStackMap aspects) throws tElementalException { if (check && !canTheyBeTogether(aspects)) throw new tElementalException("Hadron Definition error"); - this.aspectStacks = aspects; + aspectStacks = aspects; float mass=0; for(cElementalDefinitionStack stack:aspects.values()){ mass+=stack.getMass(); @@ -166,7 +166,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme @Override public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @Override @@ -204,6 +204,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme return null; } + @Override public Object materializeIntoAspect() { return aspectDefinitionCompat.getAspect(this); } @@ -220,7 +221,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme if (DEBUG_MODE) e.printStackTrace(); } if(DEBUG_MODE) - TecTech.Logger.info("Registered Elemental Matter Class: ComplexAspect "+nbtType+" "+(-96)); + TecTech.Logger.info("Registered Elemental Matter Class: ComplexAspect "+nbtType+" "+ -96); } @Override @@ -236,7 +237,7 @@ public final class dComplexAspectDefinition extends cElementalDefinition impleme @Override public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) - lines.add("CLASS = "+nbtType+" "+getClassType()); + lines.add("CLASS = "+ nbtType +" "+getClassType()); if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS, capabilities)) { lines.add("NAME = "+getName()); //lines.add("SYMBOL = "+getSymbol()); diff --git a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java index 6205055967..64c1b7ea19 100644 --- a/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java +++ b/src/main/java/com/github/technus/tectech/compatibility/thaumcraft/definitions/ePrimalAspectDefinition.java @@ -35,6 +35,7 @@ public final class ePrimalAspectDefinition extends cElementalPrimitive implement return "Primal: " + name; } + @Override public Object materializeIntoAspect() { return aspectDefinitionCompat.getAspect(this); } 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 374fad20d3..19a02fc1aa 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 @@ -29,7 +29,6 @@ import static gregtech.api.enums.GT_Values.E; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - private TileEntity container; //region Structure //use multi A energy inputs, use less power the longer it runs @@ -63,8 +62,9 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_essentiaDequantizer(this.mName); + return new GT_MetaTileEntity_EM_essentiaDequantizer(mName); } @Override @@ -102,8 +102,8 @@ public class GT_MetaTileEntity_EM_essentiaDequantizer extends GT_MetaTileEntity_ @Override public boolean checkRecipe_EM(ItemStack itemStack) { - container=essentiaContainerCompat.getContainer(this); - if (eInputHatches.size() < 1 || container==null) { + TileEntity container = essentiaContainerCompat.getContainer(this); + if (eInputHatches.size() < 1 || container ==null) { stopMachine(); return false; } 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 65a43c76ab..c2a4d13f78 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 @@ -29,7 +29,6 @@ import static gregtech.api.enums.GT_Values.E; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - private TileEntity container; //region Structure //use multi A energy inputs, use less power the longer it runs @@ -63,8 +62,9 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_essentiaQuantizer(this.mName); + return new GT_MetaTileEntity_EM_essentiaQuantizer(mName); } @Override @@ -111,7 +111,7 @@ public class GT_MetaTileEntity_EM_essentiaQuantizer extends GT_MetaTileEntity_Mu @Override public boolean checkRecipe_EM(ItemStack itemStack) { - container=essentiaContainerCompat.getContainer(this); + TileEntity container = essentiaContainerCompat.getContainer(this); cElementalInstanceStack newStack=essentiaContainerCompat.getFromContainer(container); if(newStack!=null){ mMaxProgresstime = 20; diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java index d80a2b4ccd..842d0cde5b 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDecay.java @@ -26,7 +26,7 @@ public final class cElementalDecay { for (int i = 0; i < outArr.length; i++) { outArr[i] = new cElementalDefinitionStack(outSafe[i], 1); } - this.outputStacks = new cElementalDefinitionStackMap(outArr); + outputStacks = new cElementalDefinitionStackMap(outArr); this.probability = probability; } @@ -35,7 +35,7 @@ public final class cElementalDecay { } public cElementalDecay(float probability, cElementalDefinitionStack... out) { - this.outputStacks = new cElementalDefinitionStackMap(out); + outputStacks = new cElementalDefinitionStackMap(out); this.probability = probability; } @@ -44,7 +44,7 @@ public final class cElementalDecay { } public cElementalDecay(float probability, cElementalDefinitionStackMap tree) { - this.outputStacks = tree; + outputStacks = tree; this.probability = probability; } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java index b3c66e42ce..c4dfb93bab 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalDefinitionStackMap.java @@ -53,7 +53,7 @@ public final class cElementalDefinitionStackMap/*IMMUTABLE*/ extends cElementalS } public static cElementalDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - final cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].definition.equals(nbtE__)) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java index 9fad16c46a..f5ac7b7778 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalInstanceStackMap.java @@ -114,20 +114,20 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } @Deprecated - private void removeAll(iHasElementalDefinition... hasElementals) { - for (iHasElementalDefinition has : hasElementals) + private void removeAll(iHasElementalDefinition... hasElementalDefinition) { + for (iHasElementalDefinition has : hasElementalDefinition) map.remove(has.getDefinition()); } //Remove amounts public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - final cElementalInstanceStack target = map.get(instance.definition); + cElementalInstanceStack target = map.get(instance.definition); if (target == null) return false; if (testOnly) return target.amount >= instance.amount; else { - final long diff = target.amount - instance.amount; + long diff = target.amount - instance.amount; if (diff > 0) { target.amount = diff; return true; @@ -140,13 +140,13 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - final cElementalInstanceStack target = map.get(stack.getDefinition()); + cElementalInstanceStack target = map.get(stack.getDefinition()); if (target == null) return false; if (testOnly) return target.amount >= stack.getAmount(); else { - final long diff = target.amount - stack.getAmount(); + long diff = target.amount - stack.getAmount(); if (diff > 0) { target.amount = diff; return true; @@ -185,7 +185,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn @Deprecated public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - final cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; + cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; for (int i = 0; i < stacks.length; i++) stacks[i] = new cElementalDefinitionStack(definitions[i], 1); return removeAllAmounts(testOnly, stacks); @@ -193,13 +193,11 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { boolean test=true; - for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { test &= removeAmount(true, entry.getValue()); } if (testOnly || !test) return test; - for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { removeAmount(false, entry.getValue()); } return true; @@ -207,13 +205,11 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { boolean test=true; - for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { test &= removeAmount(true, entry.getValue()); } if (testOnly || !test) return test; - for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { test &= removeAmount(false, entry.getValue()); } return true; @@ -224,14 +220,14 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn float massRemoved = 0; if (map.size() > stacksCount) { - iElementalDefinition[] keys = this.keys(); + iElementalDefinition[] keys = keys(); for (int i = stacksCount; i < keys.length; i++) { massRemoved += map.get(keys[i]).getDefinitionStack().getMass(); map.remove(keys[i]); } } - for (cElementalInstanceStack instance : this.values()) + for (cElementalInstanceStack instance : values()) if (instance.amount > stackCapacity) { massRemoved += instance.definition.getMass() * (instance.amount - stackCapacity); instance.amount = stackCapacity; @@ -246,11 +242,11 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn public void putReplaceAll(cElementalInstanceStack... instances) { for (cElementalInstanceStack instance : instances) - this.map.put(instance.definition, instance); + map.put(instance.definition, instance); } private void putReplaceAll(Map<iElementalDefinition, cElementalInstanceStack> inTreeUnsafe) { - this.map.putAll(inTreeUnsafe); + map.putAll(inTreeUnsafe); } public void putReplaceAll(cElementalInstanceStackMap inContainerUnsafe) { @@ -296,7 +292,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public String[] getElementalInfo() { - final String[] info = new String[map.size() * 4]; + String[] info = new String[map.size() * 4]; int i = 0; for (cElementalInstanceStack instance : map.values()) { info[i] = EnumChatFormatting.BLUE + instance.definition.getName(); @@ -355,7 +351,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public void tickContent(float lifeTimeMult, int postEnergize, int seconds){ - for (cElementalInstanceStack instance : this.values()) { + for (cElementalInstanceStack instance : values()) { cElementalInstanceStackMap newInstances = instance.decay(lifeTimeMult, instance.age += seconds, postEnergize); if (newInstances == null) { instance.nextColor(); @@ -371,8 +367,8 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn //NBT public NBTTagCompound getInfoNBT() { - final NBTTagCompound nbt = new NBTTagCompound(); - final String[] info = getElementalInfo(); + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); nbt.setInteger("i", info.length); for (int i = 0; i < info.length; i++) nbt.setString(Integer.toString(i), info[i]); @@ -380,8 +376,8 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public NBTTagCompound getScanInfoNBT(int[] capabilities) { - final NBTTagCompound nbt = new NBTTagCompound(); - final ArrayList<String> info = getScanInfo(capabilities); + NBTTagCompound nbt = new NBTTagCompound(); + ArrayList<String> info = getScanInfo(capabilities); nbt.setInteger("i", info.size()); for (int i = 0; i < info.size(); i++) nbt.setString(Integer.toString(i), info.get(i)); @@ -389,7 +385,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public NBTTagCompound toNBT() { - final NBTTagCompound nbt = new NBTTagCompound(); + NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", map.size()); int i = 0; for (cElementalInstanceStack instance : map.values()) @@ -398,7 +394,7 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn } public static cElementalInstanceStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - final cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; + cElementalInstanceStack[] instances = new cElementalInstanceStack[nbt.getInteger("i")]; for (int i = 0; i < instances.length; i++) { instances[i] = cElementalInstanceStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); if (instances[i].definition.equals(nbtE__)) @@ -409,14 +405,14 @@ public final class cElementalInstanceStackMap implements Comparable<cElementalIn //stackUp public static cElementalInstanceStack[] stackUp(cElementalInstanceStack... in) { - final cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); + cElementalInstanceStackMap inTree = new cElementalInstanceStackMap(); inTree.putUnifyAll(in); return inTree.values(); } @Override public int compareTo(cElementalInstanceStackMap o) { - final int sizeDiff = map.size() - o.map.size(); + int sizeDiff = map.size() - o.map.size(); if (sizeDiff != 0) return sizeDiff; cElementalInstanceStack[] ofThis = values(), ofThat = o.values(); for (int i = 0; i < ofThat.length; i++) { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java index 0873c50e14..d85d522d3a 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalMutableDefinitionStackMap.java @@ -85,20 +85,20 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa } @Deprecated - public void removeAll(iHasElementalDefinition... hasElementals) { - for (iHasElementalDefinition has : hasElementals) + public void removeAll(iHasElementalDefinition... hasElementalDefinition) { + for (iHasElementalDefinition has : hasElementalDefinition) map.remove(has.getDefinition()); } //Remove amounts public boolean removeAmount(boolean testOnly, cElementalInstanceStack instance) { - final cElementalDefinitionStack target = map.get(instance.definition); + cElementalDefinitionStack target = map.get(instance.definition); if (target == null) return false; if (testOnly) return target.amount >= instance.amount; else { - final long diff = target.amount - instance.amount; + long diff = target.amount - instance.amount; if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -111,13 +111,13 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa } public boolean removeAmount(boolean testOnly, iHasElementalDefinition stack) { - final cElementalDefinitionStack target = map.get(stack.getDefinition()); + cElementalDefinitionStack target = map.get(stack.getDefinition()); if (target == null) return false; if (testOnly) return target.amount >= stack.getAmount(); else { - final long diff = target.amount - stack.getAmount(); + long diff = target.amount - stack.getAmount(); if (diff > 0) { map.put(target.definition, new cElementalDefinitionStack(target.definition, diff)); return true; @@ -156,7 +156,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa @Deprecated public boolean removeAllAmounts(boolean testOnly, iElementalDefinition... definitions) { - final cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; + cElementalDefinitionStack[] stacks = new cElementalDefinitionStack[definitions.length]; for (int i = 0; i < stacks.length; i++) stacks[i] = new cElementalDefinitionStack(definitions[i], 1); return removeAllAmounts(testOnly, stacks); @@ -164,13 +164,11 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa public boolean removeAllAmounts(boolean testOnly, cElementalStackMap container) { boolean test=true; - for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { test &= removeAmount(true, entry.getValue()); } if (testOnly || !test) return test; - for (Iterator<Map.Entry<iElementalDefinition, cElementalDefinitionStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalDefinitionStack> entry : container.map.entrySet()) { removeAmount(false, entry.getValue()); } return true; @@ -178,13 +176,11 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa public boolean removeAllAmounts(boolean testOnly, cElementalInstanceStackMap container) { boolean test=true; - for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { test &= removeAmount(true, entry.getValue()); } if (testOnly || !test) return test; - for (Iterator<Map.Entry<iElementalDefinition, cElementalInstanceStack>> entries = container.map.entrySet().iterator(); entries.hasNext(); ) { - Map.Entry<iElementalDefinition, cElementalInstanceStack> entry = entries.next(); + for (Map.Entry<iElementalDefinition, cElementalInstanceStack> entry : container.map.entrySet()) { test &= removeAmount(false, entry.getValue()); } return true; @@ -197,16 +193,16 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa public void putReplaceAll(cElementalDefinitionStack... defStacks) { for (cElementalDefinitionStack defStack : defStacks) - this.map.put(defStack.definition, defStack); + map.put(defStack.definition, defStack); } public void putReplaceAll(cElementalStackMap inContainerUnsafe) { - this.map.putAll(inContainerUnsafe.map); + map.putAll(inContainerUnsafe.map); } //Put unify public cElementalDefinitionStack putUnify(cElementalDefinitionStack def) { - final cElementalDefinitionStack stack=map.get(def.definition); + cElementalDefinitionStack stack=map.get(def.definition); if(stack==null) return map.put(def.definition,def); return map.put(def.definition, stack.addAmountIntoNewInstance(def.amount)); } @@ -238,7 +234,7 @@ public final class cElementalMutableDefinitionStackMap extends cElementalStackMa } public static cElementalMutableDefinitionStackMap fromNBT(NBTTagCompound nbt) throws tElementalException { - final cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; + cElementalDefinitionStack[] defStacks = new cElementalDefinitionStack[nbt.getInteger("i")]; for (int i = 0; i < defStacks.length; i++) { defStacks[i] = cElementalDefinitionStack.fromNBT(nbt.getCompoundTag(Integer.toString(i))); if (defStacks[i].definition.equals(nbtE__)) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java index a5139bc254..fc2d210946 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/cElementalStackMap.java @@ -33,7 +33,7 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { } public final String[] getElementalInfo() { - final String[] info = new String[map.size() * 3]; + String[] info = new String[map.size() * 3]; int i = 0; for (cElementalDefinitionStack defStack : map.values()) { info[i] = EnumChatFormatting.BLUE + defStack.definition.getName(); @@ -71,8 +71,8 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { //NBT public final NBTTagCompound getInfoNBT() { - final NBTTagCompound nbt = new NBTTagCompound(); - final String[] info = getElementalInfo(); + NBTTagCompound nbt = new NBTTagCompound(); + String[] info = getElementalInfo(); nbt.setInteger("i", info.length); for (int i = 0; i < info.length; i++) nbt.setString(Integer.toString(i), info[i]); @@ -80,7 +80,7 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { } public final NBTTagCompound toNBT() { - final NBTTagCompound nbt = new NBTTagCompound(); + NBTTagCompound nbt = new NBTTagCompound(); nbt.setInteger("i", map.size()); int i = 0; for (cElementalDefinitionStack defStack : map.values()) @@ -90,7 +90,7 @@ abstract class cElementalStackMap implements Comparable<cElementalStackMap> { @Override public final int compareTo(cElementalStackMap o) {//this actually compares rest - final int sizeDiff = map.size() - o.map.size(); + int sizeDiff = map.size() - o.map.size(); if (sizeDiff != 0) return sizeDiff; cElementalDefinitionStack[] ofThis = values(), ofO = o.values(); for (int i = 0; i < ofO.length; i++) { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java index b6cd7a5ccb..c193e91e0b 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/rElementalRecipe.java @@ -12,7 +12,7 @@ public class rElementalRecipe implements Comparable<rElementalRecipe> { public final cElementalDefinitionStackMap outEM; public final ItemStack[] outItems; public final FluidStack[] outFluids; - public Object[] extension = null; + public Object[] extension; public rElementalRecipe( cElementalDefinitionStackMap inEM,//not null plz @@ -24,7 +24,7 @@ public class rElementalRecipe implements Comparable<rElementalRecipe> { this.outEM = outEM; this.outItems = outItems; this.outFluids = outFluids; - this.ID = id;//allows multiple recipes with the same input EM,so u can actually extend... + ID = id;//allows multiple recipes with the same input EM,so u can actually extend... } public rElementalRecipe extend(Object... data) { @@ -34,7 +34,7 @@ public class rElementalRecipe implements Comparable<rElementalRecipe> { @Override public int compareTo(rElementalRecipe o) { - final int compare = inEM.compareTo(o.inEM); + int compare = inEM.compareTo(o.inEM); return compare != 0 ? compare : (int) ID - o.ID; } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java index 3928d940b4..bd35a31192 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalDefinitionStack.java @@ -14,7 +14,7 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition public final long amount; public cElementalDefinitionStack(iElementalDefinition def, long amount) { - this.definition = def == null ? null__ : def; + definition = def == null ? null__ : def; this.amount = amount; } @@ -33,10 +33,12 @@ public final class cElementalDefinitionStack implements iHasElementalDefinition return amount; } + @Override public long getCharge() { return definition.getCharge() * amount; } + @Override public float getMass() { return definition.getMass() * amount; } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java index 525843f24c..bd401094be 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/stacks/cElementalInstanceStack.java @@ -41,16 +41,16 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } public cElementalInstanceStack(iElementalDefinition defSafe, long amount, float lifeTimeMult, long age, long energy) { - this.definition = defSafe == null ? null__ : defSafe; + definition = defSafe == null ? null__ : defSafe; byte color = definition.getColor(); if (color < 0 || color > 2) {//transforms colorable??? into proper color this.color = color; } else { - this.color = (byte) (TecTech.Rnd.nextInt(3)); + this.color = (byte) TecTech.Rnd.nextInt(3); } this.lifeTimeMult = lifeTimeMult; this.energy = energy; - this.lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; + lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; this.age = age; this.amount = amount; } @@ -76,10 +76,12 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return amount; } + @Override public long getCharge() { return definition.getCharge() * amount; } + @Override public float getMass() { return definition.getMass() * amount; } @@ -122,8 +124,8 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } public byte nextColor() {//does not allow changing magic element - if (this.color < 0 || this.color > 2) return this.color; - return this.color = (byte) (TecTech.Rnd.nextInt(3)); + if (color < 0 || color > 2) return color; + return color = (byte) TecTech.Rnd.nextInt(3); } public float getLifeTime() { @@ -133,10 +135,10 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public float setLifeTimeMultipleOfBaseValue(float mult) { if(mult<=0) //since infinity*0=nan throw new IllegalArgumentException("mult must be >0"); - this.lifeTimeMult = mult; - if (definition.getRawTimeSpan(energy) <= 0) return this.lifeTime; - this.lifeTime = definition.getRawTimeSpan(energy) * this.lifeTimeMult; - return this.lifeTime; + lifeTimeMult = mult; + if (definition.getRawTimeSpan(energy) <= 0) return lifeTime; + lifeTime = definition.getRawTimeSpan(energy) * lifeTimeMult; + return lifeTime; } public float getLifeTimeMult() { @@ -152,21 +154,21 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { } public cElementalInstanceStackMap decay(float lifeTimeMult, long apparentAge, long postEnergize) { - long newEnergyLevel=postEnergize+this.energy; + long newEnergyLevel=postEnergize+ energy; if(newEnergyLevel>0) newEnergyLevel-=1; else if(newEnergyLevel<0) newEnergyLevel+=1; - if (this.energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { + if (energy > 0 && !definition.usesSpecialEnergeticDecayHandling()) { setLifeTimeMultipleOfBaseValue(getLifeTimeMult()); - return decayCompute(definition.getEnergyInducedDecay(this.energy), lifeTimeMult, -1, newEnergyLevel); + return decayCompute(definition.getEnergyInducedDecay(energy), lifeTimeMult, -1, newEnergyLevel); }else if (definition.getRawTimeSpan(energy) < 0) { return null;//return null, decay cannot be achieved } else if(definition.isTimeSpanHalfLife()){ - return exponentialDecayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); + return exponentialDecayCompute(energy>0?definition.getEnergyInducedDecay(energy):definition.getDecayArray(), lifeTimeMult, -1, newEnergyLevel); } else{ - if (1F > this.lifeTime) { - return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getNaturalDecayInstant(), lifeTimeMult, 0, newEnergyLevel); - } else if (((float) apparentAge) > this.lifeTime) { - return decayCompute(energy>0?definition.getEnergyInducedDecay(this.energy):definition.getDecayArray(), lifeTimeMult, 0, newEnergyLevel); + if (1F > lifeTime) { + return decayCompute(energy>0?definition.getEnergyInducedDecay(energy):definition.getNaturalDecayInstant(), lifeTimeMult, 0, newEnergyLevel); + } else if ((float) apparentAge > lifeTime) { + return decayCompute(energy>0?definition.getEnergyInducedDecay(energy):definition.getDecayArray(), lifeTimeMult, 0, newEnergyLevel); } } return null;//return null since decay cannot be achieved @@ -176,7 +178,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { private cElementalInstanceStackMap exponentialDecayCompute(cElementalDecay[] decays, float lifeTimeMult, long newProductsAge, long energy) { double decayInverseRatio=Math.pow(2d,1d/* 1 second *//(double)lifeTime); double newAmount=(double)amount/decayInverseRatio; - long amountRemaining=((long)Math.floor(newAmount))+(TecTech.Rnd.nextDouble()<=newAmount-Math.floor(newAmount)?1:0); + long amountRemaining= (long)Math.floor(newAmount) +(TecTech.Rnd.nextDouble()<=newAmount-Math.floor(newAmount)?1:0); if(amountRemaining==amount) return null;//nothing decayed else if(amountRemaining<=0) return decayCompute(decays,lifeTimeMult,newProductsAge,energy); //split to non decaying and decaying part @@ -184,7 +186,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { this.amount-=amountRemaining; cElementalInstanceStackMap products=decayCompute(decays,lifeTimeMult,newProductsAge,energy); this.amount=amountRemaining; - products.putUnify(this.clone()); + products.putUnify(clone()); this.amount=amount; return products; } @@ -195,11 +197,11 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { else if (decays.length == 0) return new cElementalInstanceStackMap();//provide non null 0 length array for annihilation else if (decays.length == 1) {//only one type of decay :D, doesn't need dead end - cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, energy, this.amount); + cElementalInstanceStackMap products=decays[0].getResults(lifeTimeMult, newProductsAge, energy, amount); if(newProductsAge<0){ for(cElementalInstanceStack s:products.values()){ if(s.definition.equals(definition)){ - s.age=this.age; + s.age= age; s.energy=this.energy; } } @@ -213,14 +215,14 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { return products; } else { cElementalInstanceStackMap output = new cElementalInstanceStackMap(); - final int differentDecays = decays.length; + int differentDecays = decays.length; long[] qttyOfDecay = new long[differentDecays]; long amountRemaining = this.amount, amount = this.amount; float remainingProbability = 1F; for (int i = 0; i < differentDecays; i++) { if (decays[i].probability > 1F) { - long thisDecayAmount = (long) (Math.floor(remainingProbability * (double) amount)); + long thisDecayAmount = (long) Math.floor(remainingProbability * (double) amount); if (thisDecayAmount == 0) { //remainingProbability=something; break; @@ -235,9 +237,9 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { //remainingProbability=0; break; } - long thisDecayAmount = (long) (Math.floor(decays[i].probability * (double) amount)); + long thisDecayAmount = (long) Math.floor(decays[i].probability * (double) amount); if (thisDecayAmount <= amountRemaining && thisDecayAmount > 0) {//some was made - remainingProbability -= (decays[i].probability); + remainingProbability -= decays[i].probability; amountRemaining -= thisDecayAmount; qttyOfDecay[i] += thisDecayAmount; } else if (thisDecayAmount > amountRemaining) {//too much was made @@ -267,7 +269,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { if(newProductsAge<0){ for(cElementalInstanceStack s:output.values()){ if(s.definition.equals(definition)){ - s.age=this.age; + s.age= age; s.energy=this.energy; } } @@ -285,27 +287,27 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { public cElementalInstanceStack unifyIntoThis(cElementalInstanceStack... instances) { if (instances == null) return this; //returns with the definition from the first object passed - long energy = this.energy * this.amount; - float lifeTimeMul = this.lifeTimeMult; + long energy = this.energy * amount; + float lifeTimeMul = lifeTimeMult; for (cElementalInstanceStack instance : instances) { - if (instance != null && this.compareTo(instance) == 0) { - this.amount += instance.amount; + if (instance != null && compareTo(instance) == 0) { + amount += instance.amount; energy += instance.energy * instance.amount; lifeTimeMul = Math.min(lifeTimeMul, instance.lifeTimeMult); - this.age = Math.max(this.age, instance.age); + age = Math.max(age, instance.age); } } if (amount != 0) energy /= Math.abs(amount); this.energy = energy; - this.setLifeTimeMultipleOfBaseValue(lifeTimeMul); + setLifeTimeMultipleOfBaseValue(lifeTimeMul); return this; } public void addScanResults(ArrayList<String> lines, int[] detailsOnDepthLevels){ - final int capabilities=detailsOnDepthLevels[0]; + int capabilities=detailsOnDepthLevels[0]; if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)) lines.add("DEPTH = "+0); definition.addScanResults(lines,capabilities,energy); @@ -327,7 +329,7 @@ public final class cElementalInstanceStack implements iHasElementalDefinition { private void scanContents(ArrayList<String> lines, cElementalDefinitionStackMap definitions, int depth, int[] detailsOnDepthLevels){ if(definitions!=null && depth<detailsOnDepthLevels.length){ - final int deeper=depth+1; + int deeper=depth+1; for(cElementalDefinitionStack definitionStack:definitions.values()) { lines.add("");//def separator if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,detailsOnDepthLevels[depth])) diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java index 4906bd65f9..fedc90da99 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalDefinition.java @@ -44,7 +44,7 @@ public abstract class cElementalDefinition extends iElementalDefinition { @Override public int compareTo(iElementalDefinition o) { - final int classCompare = compareClassID(o); + int classCompare = compareClassID(o); if (classCompare != 0) return classCompare; //only of the internal def stacks!!! @@ -61,7 +61,7 @@ public abstract class cElementalDefinition extends iElementalDefinition { } if (sc == null) return 1; - final int lenDiff = tc.length - sc.length; + int lenDiff = tc.length - sc.length; if (lenDiff != 0) return lenDiff; for (int i = 0; i < tc.length; i++) { diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java index 724181e4f7..7e6e5ed3ac 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/cElementalPrimitive.java @@ -66,11 +66,11 @@ public abstract class cElementalPrimitive extends cElementalDefinition { // protected void init(cElementalPrimitive antiParticle, float rawLifeTime, int naturalInstant, int energeticInstant, cElementalDecay... elementalDecaysArray) { - this.anti = antiParticle; + anti = antiParticle; this.rawLifeTime = rawLifeTime; - this.naturalDecayInstant = (byte) naturalInstant; - this.energeticDecayInstant = (byte) energeticInstant; - this.elementalDecays = elementalDecaysArray; + naturalDecayInstant = (byte) naturalInstant; + energeticDecayInstant = (byte) energeticInstant; + elementalDecays = elementalDecaysArray; } @Override @@ -117,7 +117,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { @Override public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @Override @@ -181,7 +181,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { @Override public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) - lines.add("CLASS = "+nbtType+" "+getClassType()); + lines.add("CLASS = "+ nbtType +" "+getClassType()); if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+getName()); lines.add("SYMBOL = "+getSymbol()); @@ -205,7 +205,7 @@ public abstract class cElementalPrimitive extends cElementalDefinition { if (DEBUG_MODE) e.printStackTrace(); } if(DEBUG_MODE) - TecTech.Logger.info("Registered Elemental Matter Class: Primitive "+nbtType+" "+(-128)); + TecTech.Logger.info("Registered Elemental Matter Class: Primitive "+nbtType+" "+ -128); } @Override diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java index c34bca652e..034c90c72e 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/templates/iElementalDefinition.java @@ -66,9 +66,10 @@ public abstract class iElementalDefinition implements Comparable<iElementalDefin public abstract cElementalDefinitionStack getStackForm(int i); + @Override public abstract iElementalDefinition clone(); final int compareClassID(iElementalDefinition obj) { - return ((int) getClassType()) - obj.getClassType(); + return (int) getClassType() - obj.getClassType(); } } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java index e81809607e..6867319543 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/bTransformationInfo.java @@ -15,13 +15,13 @@ import java.util.HashMap; * Created by Tec on 26.05.2017. */ public class bTransformationInfo { - final static public HashMap<Integer,aFluidQuantizationInfo> fluidQuantization=new HashMap<>(32); + public static final HashMap<Integer,aFluidQuantizationInfo> fluidQuantization=new HashMap<>(32); public HashMap<iElementalDefinition,aFluidDequantizationInfo> fluidDequantization; - final static public HashMap<aItemQuantizationInfo,aItemQuantizationInfo> itemQuantization=new HashMap<>(32); + public static final HashMap<aItemQuantizationInfo,aItemQuantizationInfo> itemQuantization=new HashMap<>(32); public HashMap<iElementalDefinition,aItemDequantizationInfo> itemDequantization; - final static public HashMap<Integer,aOredictQuantizationInfo> oredictQuantization=new HashMap<>(32); + public static final HashMap<Integer,aOredictQuantizationInfo> oredictQuantization=new HashMap<>(32); public HashMap<iElementalDefinition,aOredictDequantizationInfo> oredictDequantization; public bTransformationInfo(){ diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/iExchangeInfo.java b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/iExchangeInfo.java index 17c4570ee1..84c5855dab 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/iExchangeInfo.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/core/transformations/iExchangeInfo.java @@ -5,7 +5,7 @@ package com.github.technus.tectech.elementalMatter.core.transformations; */ public interface iExchangeInfo { Object output();//what should be given - ItemStack,FluidStack,AspectStack, (EM definitionStack->)EM instance stack - etc. - //This must return new Object! - if obj is immutable dont care that much (applies to defStacks) + //This must return new Object! - if obj is immutable don't care that much (applies to defStacks) Object input();//same as above but for input } diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java index 6b929d66ce..8262069433 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/dAtomDefinition.java @@ -21,7 +21,6 @@ import com.github.technus.tectech.elementalMatter.definitions.primitive.eLeptonD import com.github.technus.tectech.elementalMatter.definitions.primitive.eNeutrinoDefinition; import cpw.mods.fml.common.Loader; import gregtech.api.enums.Materials; -import gregtech.api.enums.OrePrefixes; import net.minecraft.nbt.NBTTagCompound; import java.util.*; @@ -106,7 +105,7 @@ public final class dAtomDefinition extends cElementalDefinition { private dAtomDefinition(boolean check, cElementalDefinitionStackMap things) throws tElementalException { if (check && !canTheyBeTogether(things)) throw new tElementalException("Atom Definition error"); - this.elementalStacks = things; + elementalStacks = things; float mass = 0; int cLeptons = 0; @@ -132,8 +131,8 @@ public final class dAtomDefinition extends cElementalDefinition { } this.type = containsAnti ? (byte) -type : (byte) type; //this.mass = mass; - this.chargeLeptons = cLeptons; - this.charge = cNucleus + cLeptons; + chargeLeptons = cLeptons; + charge = cNucleus + cLeptons; this.neutralCount = neutralCount; this.element = element; @@ -145,46 +144,44 @@ public final class dAtomDefinition extends cElementalDefinition { int izoDiffAbs = Math.abs(izoDiff); xstr.setSeed((element + 1L) * (neutralCount + 100L)); - this.iaea=iaeaNuclide.get(element,neutralCount); + iaea =iaeaNuclide.get(element,neutralCount); if(iaea!=null){ if(Float.isNaN(iaea.mass)) this.mass=mass; else this.mass=iaea.mass; if(Float.isNaN(iaea.halfTime)) { - Float overriddenLifeTime=lifetimeOverrides.get(this); + Float overriddenLifeTime= lifetimeOverrides.get(this); float rawLifeTimeTemp; if(overriddenLifeTime!=null) rawLifeTimeTemp = overriddenLifeTime; else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; }else { - this.rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; + rawLifeTime = containsAnti ? iaea.halfTime * 1.5514433E-21f * (1f + xstr.nextFloat() * 9f) : iaea.halfTime; } - this.iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; + iaeaDefinitionExistsAndHasEnergyLevels =iaea.energeticStatesArray.length>1; }else{ this.mass=mass; - Float overriddenLifeTime=lifetimeOverrides.get(this); + Float overriddenLifeTime= lifetimeOverrides.get(this); float rawLifeTimeTemp; if(overriddenLifeTime!=null) rawLifeTimeTemp = overriddenLifeTime; else { rawLifeTimeTemp = calculateLifeTime(izoDiff, izoDiffAbs, element, neutralCount, containsAnti); } - this.rawLifeTime=rawLifeTimeTemp> STABLE_RAW_LIFE_TIME ? STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; + rawLifeTime =rawLifeTimeTemp> iElementalDefinition.STABLE_RAW_LIFE_TIME ? iElementalDefinition.STABLE_RAW_LIFE_TIME :rawLifeTimeTemp; - this.iaeaDefinitionExistsAndHasEnergyLevels =false; + iaeaDefinitionExistsAndHasEnergyLevels =false; } if(iaea==null || iaea.energeticStatesArray[0].energy!=0) { - if (izoDiff == 0) - this.decayMode = 0; - else - this.decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); + if (izoDiff == 0) decayMode = 0; + else decayMode = izoDiff > 0 ? (byte) Math.min(2, 1 + izoDiffAbs / 4) : (byte) -Math.min(2, 1 + izoDiffAbs / 4); }else{ - this.decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); + decayMode = izoDiff > 0 ? (byte) (Math.min(2, 1 + izoDiffAbs / 4)+ BYTE_OFFSET) : (byte) (-Math.min(2, 1 + izoDiffAbs / 4) + BYTE_OFFSET); } //this.stable = this.rawLifeTime >= STABLE_RAW_LIFE_TIME; @@ -201,21 +198,15 @@ public final class dAtomDefinition extends cElementalDefinition { private static float calculateLifeTime(int izoDiff, int izoDiffAbs, int element, int isotope, boolean containsAnti) { float rawLifeTime; - if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || - (element == 1 && isotope == 0) || - (element == 2 && isotope == 1) || - (izoDiffAbs == 1 && element > 2 && element % 2 == 1) || - (izoDiffAbs == 3 && element > 30 && element % 2 == 0) || - (izoDiffAbs == 5 && element > 30 && element % 2 == 0) || - (izoDiffAbs == 2 && element > 20 && element % 2 == 1))) { + if (element <= 83 && isotope < 127 && (izoDiffAbs == 0 || element == 1 && isotope == 0 || element == 2 && isotope == 1 || izoDiffAbs == 1 && element > 2 && element % 2 == 1 || izoDiffAbs == 3 && element > 30 && element % 2 == 0 || izoDiffAbs == 5 && element > 30 && element % 2 == 0 || izoDiffAbs == 2 && element > 20 && element % 2 == 1)) { rawLifeTime = containsAnti ? 2.381e4f * (1f + xstr.nextFloat() * 9f) : (1f + xstr.nextFloat() * 9f) * 1.5347e25F; } else { //Y = (X-A)/(B-A) * (D-C) + C - float unstabilityEXP = 0; + float unstabilityEXP; if (element == 0) { return 1e-35f; } else if (element == 1) { - unstabilityEXP = 1.743f - (Math.abs(izoDiff - 1) * 9.743f); + unstabilityEXP = 1.743f - Math.abs(izoDiff - 1) * 9.743f; } else if (element == 2) { switch (isotope) { case 4: @@ -231,17 +222,17 @@ public final class dAtomDefinition extends cElementalDefinition { unstabilityEXP = -(izoDiffAbs * 6.165F); break; } - } else if (element <= 83 || (isotope <= 127 && element <= 120)) { + } else if (element <= 83 || isotope <= 127 && element <= 120) { float elementPow4 = (float) Math.pow(element, 4f); - unstabilityEXP = Math.min(element / 2.4f, 6 + ((element + 1) % 2) * 3e6F / elementPow4) + (((float) -izoDiff * elementPow4) / 1e8F) - (Math.abs(izoDiff - 1 + element / 60F) * (3f - (element / 12.5f) + ((element * element) / 1500f))); + unstabilityEXP = Math.min(element / 2.4f, 6 + ((element + 1) % 2) * 3e6F / elementPow4) + (float) -izoDiff * elementPow4 / 1e8F - Math.abs(izoDiff - 1 + element / 60F) * (3f - element / 12.5f + element * element / 1500f); } else if (element < 180) { - unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - (Math.abs(izoDiff) * (3f - (element / 13f) + ((element * element) / 1600f))); + unstabilityEXP = Math.min((element - 85) * 2, 16 + ((isotope + 1) % 2) * 2.5F - (element - 85) / 3F) - Math.abs(izoDiff) * (3f - element / 13f + element * element / 1600f); } else return -1; - if ((isotope == 127 || isotope == 128) && (element < 120 && element > 83)) unstabilityEXP -= 1.8f; + if ((isotope == 127 || isotope == 128) && element < 120 && element > 83) unstabilityEXP -= 1.8f; if (element > 83 && element < 93 && isotope % 2 == 0 && izoDiff == 3) unstabilityEXP += 6; if (element > 93 && element < 103 && isotope % 2 == 0 && izoDiff == 4) unstabilityEXP += 6; - rawLifeTime = (containsAnti ? 1e-8f : 1f) * (float) (Math.pow(10F, unstabilityEXP)) * (1f + xstr.nextFloat() * 9f); + rawLifeTime = (containsAnti ? 1e-8f : 1f) * (float) Math.pow(10F, unstabilityEXP) * (1f + xstr.nextFloat() * 9f); } if (rawLifeTime < 8e-15) return 1e-35f; @@ -276,7 +267,7 @@ public final class dAtomDefinition extends cElementalDefinition { } public int getIonizationElementWise() { - return (element * 3) + chargeLeptons; + return element * 3 + chargeLeptons; } @Override @@ -313,8 +304,8 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public String getName() { - final int element = Math.abs(this.element); - final boolean negative = element < 0; + int element = Math.abs(this.element); + boolean negative = element < 0; try { if (type != 1) return (negative ? "~? " : "? ") + nomenclature.Name[element]; return negative ? "~" + nomenclature.Name[-element] : nomenclature.Name[element]; @@ -326,14 +317,14 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public String getSymbol() { - final int element = Math.abs(this.element); - final boolean negative = element < 0; + int element = Math.abs(this.element); + boolean negative = element < 0; try { return (negative ? "~" : "") + nomenclature.Symbol[element] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); } catch (Exception e) { if (DEBUG_MODE) e.printStackTrace(); try { - int s100 = element / 100, s1 = (element / 10) % 10, s10 = (element) % 10; + int s100 = element / 100, s1 = element / 10 % 10, s10 = element % 10; return (negative ? "~" : "") + nomenclature.SymbolIUPAC[10 + s100] + nomenclature.SymbolIUPAC[s10] + nomenclature.SymbolIUPAC[s1] + " N:" + neutralCount + " I:" + (neutralCount+element) + " C: " + getCharge(); } catch (Exception E) { if (DEBUG_MODE) e.printStackTrace(); @@ -354,7 +345,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private cElementalDecay[] getDecayArray(ArrayList<cElementalDecay> decaysList,int decayMode,boolean tryAnti) { - if (this.type == 1) { + if (type == 1) { switch (decayMode) { case -2: if(TecTech.Rnd.nextBoolean() && ElectronCapture(decaysList)) @@ -382,11 +373,11 @@ public final class dAtomDefinition extends cElementalDefinition { if(decayMode>8){ if(iaeaDecay(decaysList,0)) return decaysList.toArray(new cElementalDecay[decaysList.size()]); - return getDecayArray(decaysList,decayMode-BYTE_OFFSET,false); + return getDecayArray(decaysList,decayMode- BYTE_OFFSET,false); } } return cElementalDecay.noDecay; - }else if(this.type==-1){ + }else if(type ==-1){ dAtomDefinition anti=getAnti(); if(anti!=null) return anti.getDecayArray(decaysList,decayMode,false); } @@ -838,7 +829,7 @@ public final class dAtomDefinition extends cElementalDefinition { } break; case "IT": case "IT?": case "G": { if(energy>0){ - decaysList.add(new cElementalDecay(decay.chance, this, eBosonDefinition.boson_Y__)); + decaysList.add(new cElementalDecay(decay.chance, this, boson_Y__)); return true; }else{ if(DEBUG_MODE) TecTech.Logger.info("Tried to emit Gamma from ground state"); @@ -871,7 +862,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean Emmision(ArrayList<cElementalDecay> decaysList, cElementalDefinitionStack emit) { - final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, emit)) { try { decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), emit)); @@ -884,7 +875,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean alphaDecay(ArrayList<cElementalDecay> decaysList) { - final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, alpha.definition.getSubParticles())) { try { decaysList.add(new cElementalDecay((float) 1, new cElementalDefinitionStack(new dAtomDefinition(tree.toImmutable_unsafeMightLeaveExposedElementalTree()), 1), alpha)); @@ -897,7 +888,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean MbetaDecay(ArrayList<cElementalDecay> decaysList) { - final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_n1)) { try { tree.putUnify(dHadronDefinition.hadron_p1); @@ -911,7 +902,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean PbetaDecay(ArrayList<cElementalDecay> decaysList) { - final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAmount(false, dHadronDefinition.hadron_p1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); @@ -925,7 +916,7 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean ElectronCapture(ArrayList<cElementalDecay> decaysList) { - final cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); + cElementalMutableDefinitionStackMap tree = elementalStacks.toMutable(); if (tree.removeAllAmounts(false, dHadronDefinition.hadron_p1,eLeptonDefinition.lepton_e1)) { try { tree.putUnify(dHadronDefinition.hadron_n1); @@ -939,12 +930,12 @@ public final class dAtomDefinition extends cElementalDefinition { } private boolean Fission(ArrayList<cElementalDecay> decaysList, cElementalMutableDefinitionStackMap fissile, cElementalMutableDefinitionStackMap particles,float probability,boolean spontaneousCheck) { - final cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); - final double[] liquidDrop=liquidDropFunction(Math.abs(element)<=97); + cElementalMutableDefinitionStackMap heavy = new cElementalMutableDefinitionStackMap(); + double[] liquidDrop= liquidDropFunction(Math.abs(element)<=97); for(cElementalDefinitionStack stack: fissile.values()){ if(spontaneousCheck && stack.definition instanceof dHadronDefinition && - (stack.amount<=80 || (stack.amount<90 && XSTR_INSTANCE.nextInt(10)<stack.amount-80))) + (stack.amount<=80 || stack.amount<90 && XSTR_INSTANCE.nextInt(10)<stack.amount-80)) return false; if(stack.definition.getCharge()==0){ //if(stack.definition instanceof dHadronDefinition){ @@ -1023,7 +1014,7 @@ public final class dAtomDefinition extends cElementalDefinition { } } if(energyLevel< Math.abs(charge)/3+neutralCount) { - return new cElementalDecay[]{new cElementalDecay(1, this, eBosonDefinition.boson_Y__)}; + return new cElementalDecay[]{new cElementalDecay(1, this, boson_Y__)}; } return getNaturalDecayInstant(); } @@ -1040,18 +1031,18 @@ public final class dAtomDefinition extends cElementalDefinition { } if(currentEnergyLevel<=0){ - if(newEnergyLevel<=0) return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); - else result+=DEFAULT_ENERGY_REQUIREMENT*(-currentEnergyLevel); + if(newEnergyLevel<=0) return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + else result+= iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT * -currentEnergyLevel; }else result-=iaea.energeticStatesArray[(int)Math.min(iaea.energeticStatesArray.length-1,currentEnergyLevel)].energy; if(newEnergyLevel>=iaea.energeticStatesArray.length){ - if(currentEnergyLevel>=iaea.energeticStatesArray.length) return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); - else result+=DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-iaea.energeticStatesArray.length+1); + if(currentEnergyLevel>=iaea.energeticStatesArray.length) return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); + else result+= iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-iaea.energeticStatesArray.length+1); result+=iaea.energeticStatesArray[iaea.energeticStatesArray.length-1].energy; }else result+=iaea.energeticStatesArray[(int)Math.max(0,newEnergyLevel)].energy; return backwards?-result:result; } - return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @Override @@ -1072,7 +1063,7 @@ public final class dAtomDefinition extends cElementalDefinition { decaysInto.add(new cElementalDefinitionStack(boson_Y__, 2)); } } - return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), eBosonDefinition.deadEnd}; + return new cElementalDecay[]{new cElementalDecay(0.75F, decaysInto.toArray(new cElementalDefinitionStack[decaysInto.size()])), deadEnd}; } //@Override @@ -1118,11 +1109,11 @@ public final class dAtomDefinition extends cElementalDefinition { return transformation.oredictDequantization.get(this); } - private final static class nomenclature { + private static final class nomenclature { private nomenclature(){} - static final private String[] Symbol = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; - static final private String[] Name = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; - static final private String[] SymbolIUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; + private static final String[] Symbol = new String[]{"Nt", "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar", "K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn", "Ga", "Ge", "As", "Se", "Br", "Kr", "Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd", "In", "Sn", "Sb", "Te", "I", "Xe", "Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn", "Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds", "Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og"}; + private static final String[] Name = new String[]{"Neutronium", "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + private static final String[] SymbolIUPAC = new String[]{"n", "u", "b", "t", "q", "p", "h", "s", "o", "e", "N", "U", "B", "T", "Q", "P", "H", "S", "O", "E"}; } @Override @@ -1164,12 +1155,12 @@ public final class dAtomDefinition extends cElementalDefinition { for (int isotope = 0; isotope < 130; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - final int StableIsotope = stableIzoCurve(element); - final int izoDiff = isotope - StableIsotope; - final int izoDiffAbs = Math.abs(izoDiff); - final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + int StableIsotope = stableIzoCurve(element); + int izoDiff = isotope - StableIsotope; + int izoDiffAbs = Math.abs(izoDiff); + float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); iaeaNuclide nuclide=iaeaNuclide.get(element,isotope); - if (rawLifeTime>= STABLE_RAW_LIFE_TIME || (nuclide!=null && nuclide.halfTime >=STABLE_RAW_LIFE_TIME)) { + if (rawLifeTime>= STABLE_RAW_LIFE_TIME || nuclide!=null && nuclide.halfTime >=STABLE_RAW_LIFE_TIME) { TreeSet<Integer> isotopes = stableIsotopes.get(element); if (isotopes == null) stableIsotopes.put(element, isotopes = new TreeSet<>()); isotopes.add(isotope); @@ -1181,10 +1172,10 @@ public final class dAtomDefinition extends cElementalDefinition { for (int isotope = 100; isotope < 180; isotope++) { xstr.setSeed((long) (element + 1) * (isotope + 100)); //stability curve - final int Isotope = stableIzoCurve(element); - final int izoDiff = isotope - Isotope; - final int izoDiffAbs = Math.abs(izoDiff); - final float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); + int Isotope = stableIzoCurve(element); + int izoDiff = isotope - Isotope; + int izoDiffAbs = Math.abs(izoDiff); + float rawLifeTime = calculateLifeTime(izoDiff, izoDiffAbs, element, isotope, false); TreeMap<Float, Integer> isotopes = mostStableUnstableIsotopes.get(element); if (isotopes == null) mostStableUnstableIsotopes.put(element, isotopes = new TreeMap<>()); isotopes.put(rawLifeTime, isotope); @@ -1368,28 +1359,28 @@ public final class dAtomDefinition extends cElementalDefinition { new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 146) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium/*238*/,1); + transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium/*238*/,1); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 92), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 143) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Uranium235,1); + transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Uranium235,1); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 145) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium/*239*/,1); + transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Plutonium/*239*/,1); temp=new dAtomDefinition( new cElementalDefinitionStack(eLeptonDefinition.lepton_e, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_p, 94), new cElementalDefinitionStack(dHadronDefinition.hadron_n, 147) ); - transformation.addOredict(new cElementalDefinitionStack(temp, 144),OrePrefixes.dust, Materials.Plutonium241,1); + transformation.addOredict(new cElementalDefinitionStack(temp, 144), dust, Materials.Plutonium241,1); } catch (tElementalException e) { if (DEBUG_MODE) e.printStackTrace(); } @@ -1418,7 +1409,7 @@ public final class dAtomDefinition extends cElementalDefinition { @Override public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) - lines.add("CLASS = "+nbtType+" "+getClassType()); + lines.add("CLASS = "+ nbtType +" "+getClassType()); if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+getName()); lines.add("SYMBOL = "+getSymbol()); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java index d9717b33b3..1feb8253e3 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/atom/iaeaNuclide.java @@ -91,13 +91,13 @@ public final class iaeaNuclide { private iaeaNuclide(String[][] rows){ N=Short.parseShort(rows[1][2]); Z=Short.parseShort(rows[1][0]); - NUCLIDES.put((((int)Z)<<16)+N,this); + NUCLIDES.put(((int)Z <<16)+N,this); String[] parts = Util.splitButDifferent(rows[0][16], "|"); double Mass=doubleOrNaN(parts[0],"mass"); if(!Double.isNaN(Mass)) { //System.out.println("Mass =\t" + Mass+"\t"+(N+Z)+"\t"+N+"\t"+Z+"\t"+(Mass/(N+Z))); - mass = (float)(Mass*MICRO_AMU_TO_EV_DIV_C_C); + mass = (float)(Mass* MICRO_AMU_TO_EV_DIV_C_C); } else mass=Float.NaN; @@ -117,12 +117,12 @@ public final class iaeaNuclide { // if (add(cells[17])) System.out.println(N + " " + Z); // if (add(cells[20])) System.out.println(N + " " + Z); //} - new energeticState(this, halfTime,getDecaysFixed(cells[14],doubleOrNaN(cells[15],"chance1"),cells[17],doubleOrNaN(cells[18],"chance1"),cells[20],doubleOrNaN(cells[21],"chance1"))); + new energeticState(this, halfTime, getDecaysFixed(cells[14],doubleOrNaN(cells[15],"chance1"),cells[17],doubleOrNaN(cells[18],"chance1"),cells[20],doubleOrNaN(cells[21],"chance1"))); } private static final energeticState[] empty=new energeticState[0]; private void makeArrayOfEnergyStates(){ - if(energeticStates==null || energeticStates.size()==0)energeticStatesArray=empty; + if(energeticStates==null || energeticStates.size()==0)energeticStatesArray= empty; else energeticStatesArray=energeticStates.values().toArray(new energeticState[energeticStates.size()]); } @@ -156,12 +156,12 @@ public final class iaeaNuclide { } private energeticState(String[] cells){ - iaeaNuclide nuclide=get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); + iaeaNuclide nuclide= get((int)doubleOrNaN(cells[0],"protons"),(int)doubleOrNaN(cells[1],"neutrons")); if(nuclide==null) throw new Error("Missing nuclide "+(int)doubleOrNaN(cells[0],"protons")+" "+(int)doubleOrNaN(cells[1],"neutrons")); - this.energy=(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000f);//to eV + energy =(float) (doubleOrNaN(cells[3],"energy level",nuclide)*1000f);//to eV if(energy<0) throw new Error("Invalid energy "+ nuclide.N +" "+nuclide.Z+ " "+cells[3]); - this.Thalf=(float) doubleOrNaN(cells[10],"half life",nuclide); + Thalf =(float) doubleOrNaN(cells[10],"half life",nuclide); if(nuclide.energeticStates==null) { new Exception("Should be initialized before doing this... "+ nuclide.N +" "+nuclide.Z).printStackTrace(); nuclide.energeticStates = new TreeMap<>(); @@ -172,7 +172,7 @@ public final class iaeaNuclide { // if (add(cells[15])) System.out.println(nuclide.N + " " + nuclide.Z); // if (add(cells[18])) System.out.println(nuclide.N + " " + nuclide.Z); //} - this.decaymodes=getDecaysFixed(cells[12],doubleOrNaN(cells[13],"chance 1",nuclide),cells[15],doubleOrNaN(cells[16],"chance 2",nuclide),cells[18],doubleOrNaN(cells[19],"chance 3",nuclide)); + decaymodes = getDecaysFixed(cells[12],doubleOrNaN(cells[13],"chance 1",nuclide),cells[15],doubleOrNaN(cells[16],"chance 2",nuclide),cells[18],doubleOrNaN(cells[19],"chance 3",nuclide)); } private double doubleOrNaN(String s, String name){ @@ -208,43 +208,43 @@ public final class iaeaNuclide { private static iaeaDecay[] getDecaysFixed(String decay1, double chance1,String decay2, double chance2,String decay3, double chance3){ boolean do1,do2,do3; - do1=(decay1.length()>0 && !Double.isNaN(chance1)); - do2=(decay2.length()>0 && !Double.isNaN(chance2)); - do3=(decay3.length()>0 && !Double.isNaN(chance3)); + do1= decay1.length()>0 && !Double.isNaN(chance1); + do2= decay2.length()>0 && !Double.isNaN(chance2); + do3= decay3.length()>0 && !Double.isNaN(chance3); TreeMap<Double,iaeaDecay> decays=new TreeMap<>(); if(do1 && do2 && chance1==100 && chance2==100 && chance3!=100){ decays.put(1D, new iaeaDecay(1f, decay1)); if(do3) { chance3/=100d; - decays.put(chance3, new iaeaDecay((float) (chance3), decay2)); + decays.put(chance3, new iaeaDecay((float) chance3, decay2)); chance2=1d-chance3; } chance2/=2d; - decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + decays.put(chance2, new iaeaDecay((float) chance2, decay2)); }else if(do1 && chance1==100){ decays.put(1D, new iaeaDecay(1f, decay1)); if(do2) { chance2/=100d; - decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + decays.put(chance2, new iaeaDecay((float) chance2, decay2)); } if(do3) { chance3 /= 100d; if(do2) chance3 *= chance2; - decays.put(chance3, new iaeaDecay((float) (chance3), decay3)); + decays.put(chance3, new iaeaDecay((float) chance3, decay3)); } }else{ - double normalization=((do1?chance1:0)+(do2?chance2:0)+(do3?chance3:0)); + double normalization= (do1?chance1:0) + (do2?chance2:0) + (do3?chance3:0); if(do1) { chance1/=normalization; - decays.put(chance1, new iaeaDecay((float) (chance1), decay1)); + decays.put(chance1, new iaeaDecay((float) chance1, decay1)); } if(do2) { chance2/=normalization; - decays.put(chance2, new iaeaDecay((float) (chance2), decay2)); + decays.put(chance2, new iaeaDecay((float) chance2, decay2)); } if(do3) { chance3/=normalization; - decays.put(chance3, new iaeaDecay((float) (chance3), decay3)); + decays.put(chance3, new iaeaDecay((float) chance3, decay3)); } if(do1||do2||do3) decays.put(1D,iaeaDecay.DEAD_END); diff --git a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java index 8c7f8deb30..63766d8a4e 100644 --- a/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java +++ b/src/main/java/com/github/technus/tectech/elementalMatter/definitions/complex/hadron/dHadronDefinition.java @@ -2,7 +2,6 @@ package com.github.technus.tectech.elementalMatter.definitions.complex.hadron; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.Util; -import com.github.technus.tectech.auxiliary.TecTechConfig; import com.github.technus.tectech.elementalMatter.core.cElementalDecay; import com.github.technus.tectech.elementalMatter.core.cElementalDefinitionStackMap; import com.github.technus.tectech.elementalMatter.core.cElementalMutableDefinitionStackMap; @@ -76,7 +75,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi private dHadronDefinition(boolean check, cElementalDefinitionStackMap quarks) throws tElementalException { if (check && !canTheyBeTogether(quarks)) throw new tElementalException("Hadron Definition error"); - this.quarkStacks = quarks; + quarkStacks = quarks; byte amount = 0; int charge = 0; @@ -92,19 +91,19 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi } this.amount = amount; this.charge = charge; - this.type = containsAnti ? (byte) (-type) : (byte) type; + this.type = containsAnti ? (byte) -type : (byte) type; int mult = this.amount * this.amount * (this.amount - 1); this.mass = mass * 5.543F * (float) mult;//yes it becomes heavier - if (this.mass == protonMass && this.amount == 3) this.rawLifeTime = STABLE_RAW_LIFE_TIME; - else if (this.mass == neutronMass && this.amount == 3) this.rawLifeTime = 882F; + if (this.mass == protonMass && this.amount == 3) rawLifeTime = iElementalDefinition.STABLE_RAW_LIFE_TIME; + else if (this.mass == neutronMass && this.amount == 3) rawLifeTime = 882F; else { if (this.amount == 3) { - this.rawLifeTime = (1.34F / this.mass) * (float) Math.pow(9.81, charge); + rawLifeTime = 1.34F / this.mass * (float) Math.pow(9.81, charge); } else if (this.amount == 2) { - this.rawLifeTime = (1.21F / this.mass) / (float) Math.pow(19.80, charge); + rawLifeTime = 1.21F / this.mass / (float) Math.pow(19.80, charge); } else { - this.rawLifeTime = (1.21F / this.mass) / (float) Math.pow(9.80, charge); + rawLifeTime = 1.21F / this.mass / (float) Math.pow(9.80, charge); } } @@ -198,7 +197,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public float getEnergyDiffBetweenStates(long currentEnergyLevel, long newEnergyLevel) { - return DEFAULT_ENERGY_REQUIREMENT*(newEnergyLevel-currentEnergyLevel); + return iElementalDefinition.DEFAULT_ENERGY_REQUIREMENT *(newEnergyLevel-currentEnergyLevel); } @Override @@ -214,7 +213,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi else if (amount != 3) return new cElementalDecay[]{new cElementalDecay(0.95F, quarkStacks), eBosonDefinition.deadEnd}; //decay into quarks else { - ArrayList<eQuarkDefinition> newBaryon = new ArrayList<eQuarkDefinition>(); + ArrayList<eQuarkDefinition> newBaryon = new ArrayList<>(); iElementalDefinition[] Particles = new iElementalDefinition[2]; for (cElementalDefinitionStack quarks : quarkStacks) { for (int i = 0; i < quarks.amount; i++) @@ -297,7 +296,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi try { return new dHadronDefinition(anti.toImmutable_unsafeMightLeaveExposedElementalTree()); } catch (tElementalException e) { - if (TecTechConfig.DEBUG_MODE) e.printStackTrace(); + if (DEBUG_MODE) e.printStackTrace(); return null; } } @@ -346,12 +345,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi protonMass = hadron_p.mass; //redefine the proton with proper lifetime (the lifetime is based on mass comparison) hadron_p = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(2), eQuarkDefinition.quark_d.getStackForm(1))); - hadron_p_ = (dHadronDefinition) (hadron_p.getAnti()); + hadron_p_ = (dHadronDefinition) hadron_p.getAnti(); hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); neutronMass = hadron_n.mass; //redefine the neutron with proper lifetime (the lifetime is based on mass comparison) hadron_n = new dHadronDefinition(new cElementalDefinitionStackMap(eQuarkDefinition.quark_u.getStackForm(1), eQuarkDefinition.quark_d.getStackForm(2))); - hadron_n_ = (dHadronDefinition) (hadron_n.getAnti()); + hadron_n_ = (dHadronDefinition) hadron_n.getAnti(); } catch (tElementalException e) { if (DEBUG_MODE) e.printStackTrace(); protonMass = -1; @@ -371,12 +370,12 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi if (DEBUG_MODE) e.printStackTrace(); } if(DEBUG_MODE) - TecTech.Logger.info("Registered Elemental Matter Class: Hadron "+nbtType+" "+(-64)); + TecTech.Logger.info("Registered Elemental Matter Class: Hadron "+nbtType+" "+ -64); } public static void setTransformations(){ //Added to atom map, but should be in its own - cElementalDefinitionStack neutrons=new cElementalDefinitionStack(dHadronDefinition.hadron_n, 100000); + cElementalDefinitionStack neutrons=new cElementalDefinitionStack(hadron_n, 100000); transformation.oredictDequantization.put(neutrons.definition,new aOredictDequantizationInfo(neutrons, dust, Materials.Neutronium,1)); bTransformationInfo.oredictQuantization.put( OreDictionary.getOreID(OrePrefixes.ingotHot.name()+Materials.Neutronium.mName), @@ -397,7 +396,7 @@ public final class dHadronDefinition extends cElementalDefinition {//TODO Optimi @Override public void addScanResults(ArrayList<String> lines, int capabilities, long energyLevel) { if(Util.areBitsSet(SCAN_GET_CLASS_TYPE, capabilities)) - lines.add("CLASS = "+nbtType+" "+getClassType()); + lines.add("CLASS = "+ nbtType +" "+getClassType()); if(Util.areBitsSet(SCAN_GET_NOMENCLATURE|SCAN_GET_CHARGE|SCAN_GET_MASS|SCAN_GET_TIMESPAN_INFO, capabilities)) { lines.add("NAME = "+getSimpleName()); //lines.add("SYMBOL = "+getSymbol()); diff --git a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java index 3bcb1e799b..1234538839 100644 --- a/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java +++ b/src/main/java/com/github/technus/tectech/entity/fx/BlockHint.java @@ -28,9 +28,9 @@ public class BlockHint extends EntityFX { @Override public void renderParticle(Tessellator tes, float subTickTime, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_) { float size = .5f; - float X = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) subTickTime - interpPosX); - float Y = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) subTickTime - interpPosY) - size / 2; - float Z = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) subTickTime - interpPosZ); + float X = (float) (prevPosX + (posX - prevPosX) * (double) subTickTime - EntityFX.interpPosX); + float Y = (float) (prevPosY + (posY - prevPosY) * (double) subTickTime - EntityFX.interpPosY) - size / 2; + float Z = (float) (prevPosZ + (posZ - prevPosZ) * (double) subTickTime - EntityFX.interpPosZ); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); tes.setColorRGBA_F(.9F, .95F, 1F, .75f); diff --git a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java index fdbfc1cda5..ec321fd3b8 100644 --- a/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ElementalLoader.java @@ -12,6 +12,7 @@ import com.github.technus.tectech.elementalMatter.definitions.primitive.*; * Created by danie_000 on 16.11.2016. */ public class ElementalLoader implements Runnable { + @Override public void run() { // =================================================================================================== // Definition init diff --git a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java index 787096e6b6..e242ba7670 100644 --- a/src/main/java/com/github/technus/tectech/loader/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MachineLoader.java @@ -17,6 +17,7 @@ import static com.github.technus.tectech.thing.CustomItemList.*; * Created by danie_000 on 16.11.2016. */ public class MachineLoader implements Runnable { + @Override public void run() { // =================================================================================================== // eM IN diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index 1fc1ddda22..f05ee2b46f 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -62,8 +62,8 @@ public final class MainLoader { TecTech.Logger.info("Entities registered"); progressBarLoad.step("Add damage types"); - microwaving=new DamageSource("microwaving").setDamageBypassesArmor(); - elementalPollution=new DamageSource("elementalPollution").setDamageBypassesArmor(); + microwaving =new DamageSource("microwaving").setDamageBypassesArmor(); + elementalPollution =new DamageSource("elementalPollution").setDamageBypassesArmor(); TecTech.Logger.info("Damage types addition Done"); ProgressManager.pop(progressBarLoad); diff --git a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java index 360604e7b8..0190a11f8d 100644 --- a/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/RecipeLoader.java @@ -17,6 +17,7 @@ import static gregtech.api.enums.GT_Values.RA; * Created by danie_000 on 16.11.2016. */ public class RecipeLoader implements Runnable { + @Override public void run() { dAtomDefinition.setTransformation(); dHadronDefinition.setTransformations(); diff --git a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java index 8c1a0cad34..c066c84aa1 100644 --- a/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/ThingsLoader.java @@ -20,6 +20,7 @@ import static com.github.technus.tectech.TecTech.tectechTexturePage1; * Created by danie_000 on 16.11.2016. */ public class ThingsLoader implements Runnable { + @Override public void run() { if(Textures.BlockIcons.casingTexturePages[tectechTexturePage1]==null) Textures.BlockIcons.casingTexturePages[tectechTexturePage1]=new ITexture[128]; diff --git a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java index 05f5018fdc..3e1949014d 100644 --- a/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java +++ b/src/main/java/com/github/technus/tectech/nei/NEI_TT_Config.java @@ -9,6 +9,7 @@ public class NEI_TT_Config implements IConfigureNEI {//must be NEI*Config public static TT_NEI_ResearchHandler TT_RH; public static TT_NEI_ScannerHandler TT_SH; + @Override public void loadConfig() { sIsAdded = false; if(FMLCommonHandler.instance().getEffectiveSide().isClient()) { @@ -18,10 +19,12 @@ public class NEI_TT_Config implements IConfigureNEI {//must be NEI*Config sIsAdded = true; } + @Override public String getName() { return "TecTech NEI Plugin"; } + @Override public String getVersion() { return "(1.0)"; } diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java index 38a127900b..dd20554887 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ResearchHandler.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.nei; import codechicken.lib.gui.GuiDraw; +import codechicken.nei.ItemList; import codechicken.nei.PositionedStack; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; @@ -8,6 +9,7 @@ import codechicken.nei.guihook.IContainerTooltipHandler; import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.auxiliary.Reference; @@ -35,6 +37,8 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import static gregtech.api.enums.ItemList.Display_Fluid; + public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public static final int sOffsetX = 5; public static final int sOffsetY = 11; @@ -47,8 +51,8 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { protected final TT_recipe.GT_Recipe_MapTT mRecipeMap; public TT_NEI_ResearchHandler(TT_recipe.GT_Recipe_MapTT aRecipeMap) { - this.mRecipeMap = aRecipeMap; - this.transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + mRecipeMap = aRecipeMap; + transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); if (!NEI_TT_Config.sIsAdded) { FMLInterModComms.sendRuntimeMessage(TecTech.instance, "NEIPlugins", "register-crafting-handler", Reference.MODID+"@" + getRecipeName() + "@" + getOverlayIdentifier()); GuiCraftingRecipe.craftinghandlers.add(this); @@ -57,7 +61,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { } public List<GT_Recipe> getSortedRecipes() { - List<GT_Recipe> result = new ArrayList<>(this.mRecipeMap.mRecipeList); + List<GT_Recipe> result = new ArrayList<>(mRecipeMap.mRecipeList); Collections.sort(result); return result; } @@ -66,16 +70,18 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); } + @Override public TemplateRecipeHandler newInstance() { NEI_TT_Config.TT_RH=new TT_NEI_ResearchHandler(mRecipeMap); return NEI_TT_Config.TT_RH; } + @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOverlayIdentifier())) { for (GT_Recipe tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + arecipes.add(new CachedDefaultRecipe(tRecipe)); } } } else { @@ -83,13 +89,14 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { } } + @Override public void loadCraftingRecipes(ItemStack aResult) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); ArrayList<ItemStack> tResults = new ArrayList<>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + if (tPrefixMaterial != null && !tPrefixMaterial.mBlackListed && !tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty()) { for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } @@ -108,7 +115,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tResults) { if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); + arecipes.add(tNEIRecipe); break; } } @@ -117,13 +124,14 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe; } + @Override public void loadUsageRecipes(ItemStack aInput) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); ArrayList<ItemStack> tInputs = new ArrayList<>(); tInputs.add(aInput); tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + if (tPrefixMaterial != null && !tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty()) { for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } @@ -142,7 +150,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tInputs) { if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); + arecipes.add(tNEIRecipe); break; } } @@ -151,36 +159,42 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe; } + @Override public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; + return mRecipeMap.mNEIName; } + @Override public void drawBackground(int recipe) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiDraw.changeTexture(getGuiTexture()); GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); } + @Override public int recipiesPerPage() { return 1; } + @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + return GT_LanguageManager.getTranslation(mRecipeMap.mUnlocalizedName); } + @Override public String getGuiTexture() { // return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; - return this.mRecipeMap.mNEIGUIPath; + return mRecipeMap.mNEIGUIPath; } + @Override public List<String> handleItemTooltip(GuiRecipe gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { - TemplateRecipeHandler.CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { + TemplateRecipeHandler.CachedRecipe tObject = arecipes.get(aRecipeIndex); + if (tObject instanceof CachedDefaultRecipe) { CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; for (PositionedStack tStack : tRecipe.mOutputs) { if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + if (!(tStack instanceof FixedPositionedStack) || ((FixedPositionedStack) tStack).mChance <= 0 || ((FixedPositionedStack) tStack).mChance == 10000) { break; } currenttip.add(trans("150","Chance: ") + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); @@ -189,8 +203,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { } for (PositionedStack tStack : tRecipe.mInputs) { if (aStack == tStack.item) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { + if (Display_Fluid.isStackEqual(tStack.item, true, true) || tStack.item.stackSize != 0) { break; } currenttip.add(trans("151","Does not get consumed in the process")); @@ -201,22 +214,23 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { return currenttip; } - public void drawExtras(int aRecipeIndex) { - int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - int computation = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + @Override + public void drawExtras(int aRecipeIndex) { + int tEUt = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mEUt; + int computation = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mDuration; + String[] recipeDesc = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); if (recipeDesc == null) { - int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + int tSpecial = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; short ampere=(short) (tSpecial & 0xFFFF),minComputationPerSec=(short)(tSpecial>>>16); if (tEUt != 0) { - drawText(10, 73, trans("152","Max Total: ") + ((1+((computation-minComputationPerSec)/minComputationPerSec)) * (long)tEUt * ampere * 20) + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + ((long)tEUt*ampere) + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 73, trans("152","Max Total: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + (long)tEUt*ampere + " EU/t", -16777216); + if (mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); } else { - drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); - drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); + drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); + drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } drawText(10, 113, "Computation: "+computation, -16777216); @@ -224,7 +238,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { } else { int i = 0; for (String descLine : recipeDesc) { - drawText(10, 73 + 10 * i, descLine, -16777216); + drawText(10, 73 + 10 * i, descLine, -16777216); i++; } } @@ -232,6 +246,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler { + @Override public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { if (canHandle(gui)) { if (button == 0) { @@ -244,19 +259,21 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { return false; } + @Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } public boolean canHandle(GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) || ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))); + return gui instanceof GT_GUIContainer_BasicMachine && GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI) || gui instanceof GT_GUIContainer_FusionReactor && GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI); } + @Override public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) { - if ((canHandle(gui)) && (currenttip.isEmpty())) { - if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + if (canHandle(gui) && currenttip.isEmpty()) { + if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); - } else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + } else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); } @@ -266,41 +283,50 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { private boolean transferRect(GuiContainer gui, boolean usage) { if (gui instanceof GT_GUIContainer_BasicMachine) { - return (canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI)); + return canHandle(gui) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1])) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI)); } else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI)); + return canHandle(gui) && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1])) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI)); } return false; } + @Override public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) { return currenttip; } + @Override public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) { return currenttip; } + @Override public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } + @Override public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { } + @Override public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { } + @Override public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { } + @Override public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { return false; } + @Override public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { } + @Override public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { } } @@ -315,18 +341,19 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public FixedPositionedStack(Object object, int x, int y, int aChance) { super(object, x, y, true); - this.mChance = aChance; + mChance = aChance; } + @Override public void generatePermutations() { - if (this.permutated) { + if (permutated) { return; } ArrayList<ItemStack> tDisplayStacks = new ArrayList<>(); - for (ItemStack tStack : this.items) { + for (ItemStack tStack : items) { if (GT_Utility.isStackValid(tStack)) { if (tStack.getItemDamage() == 32767) { - List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + List<ItemStack> permutations = ItemList.itemMap.get(tStack.getItem()); if (!permutations.isEmpty()) { ItemStack stack; for (Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, stack))) { @@ -342,11 +369,11 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { } } } - this.items = tDisplayStacks.toArray(new ItemStack[0]); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + items = tDisplayStacks.toArray(new ItemStack[0]); + if (items.length == 0) { + items = new ItemStack[]{new ItemStack(Blocks.fire)}; } - this.permutated = true; + permutated = true; setPermutationToRender(0); } } @@ -358,8 +385,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { public final List<PositionedStack> mInputs; public CachedDefaultRecipe(GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; + mRecipe = aRecipe; mOutputs = new ArrayList<>(); mInputs = new ArrayList<>(); @@ -370,7 +396,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { // break; //case 1: if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14+9)); + mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14+9)); } //tStartIndex++; //break; @@ -567,7 +593,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { // tStartIndex++; //} if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); } //tStartIndex = 0; //switch (mRecipeMap.mUsualOutputCount) { @@ -575,7 +601,7 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { // break; //case 1: if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14+9, aRecipe.getOutputChance(tStartIndex))); + mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14+9, aRecipe.getOutputChance(tStartIndex))); } //tStartIndex++; //break; @@ -798,16 +824,19 @@ public class TT_NEI_ResearchHandler extends TemplateRecipeHandler { //} } + @Override public List<PositionedStack> getIngredients() { - return getCycledIngredients(cycleticks / 10, this.mInputs); + return getCycledIngredients(cycleticks / 10, mInputs); } + @Override public PositionedStack getResult() { return null; } + @Override public List<PositionedStack> getOtherStacks() { - return this.mOutputs; + return mOutputs; } } diff --git a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java index 5ec6e18874..611e2bafa0 100644 --- a/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java +++ b/src/main/java/com/github/technus/tectech/nei/TT_NEI_ScannerHandler.java @@ -1,6 +1,7 @@ package com.github.technus.tectech.nei; import codechicken.lib.gui.GuiDraw; +import codechicken.nei.ItemList; import codechicken.nei.PositionedStack; import codechicken.nei.guihook.GuiContainerManager; import codechicken.nei.guihook.IContainerInputHandler; @@ -8,6 +9,7 @@ import codechicken.nei.guihook.IContainerTooltipHandler; import codechicken.nei.recipe.GuiCraftingRecipe; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.GuiUsageRecipe; +import codechicken.nei.recipe.RecipeInfo; import codechicken.nei.recipe.TemplateRecipeHandler; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.auxiliary.Reference; @@ -35,6 +37,8 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import static gregtech.api.enums.ItemList.Display_Fluid; + public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { public static final int sOffsetX = 5; public static final int sOffsetY = 11; @@ -47,8 +51,8 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { protected final TT_recipe.GT_Recipe_MapTT mRecipeMap; public TT_NEI_ScannerHandler(TT_recipe.GT_Recipe_MapTT aRecipeMap) { - this.mRecipeMap = aRecipeMap; - this.transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); + mRecipeMap = aRecipeMap; + transferRects.add(new RecipeTransferRect(new Rectangle(65, 13, 36, 18), getOverlayIdentifier())); if (!NEI_TT_Config.sIsAdded) { FMLInterModComms.sendRuntimeMessage(TecTech.instance, "NEIPlugins", "register-crafting-handler", Reference.MODID+"@" + getRecipeName() + "@" + getOverlayIdentifier()); GuiCraftingRecipe.craftinghandlers.add(this); @@ -57,7 +61,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { } public List<GT_Recipe> getSortedRecipes() { - List<GT_Recipe> result = new ArrayList<>(this.mRecipeMap.mRecipeList); + List<GT_Recipe> result = new ArrayList<>(mRecipeMap.mRecipeList); Collections.sort(result); return result; } @@ -66,16 +70,18 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { Minecraft.getMinecraft().fontRenderer.drawString(aString, aX, aY, aColor); } + @Override public TemplateRecipeHandler newInstance() { NEI_TT_Config.TT_SH=new TT_NEI_ScannerHandler(mRecipeMap); return NEI_TT_Config.TT_SH; } + @Override public void loadCraftingRecipes(String outputId, Object... results) { if (outputId.equals(getOverlayIdentifier())) { for (GT_Recipe tRecipe : getSortedRecipes()) { if (!tRecipe.mHidden) { - this.arecipes.add(new CachedDefaultRecipe(tRecipe)); + arecipes.add(new CachedDefaultRecipe(tRecipe)); } } } else { @@ -83,13 +89,14 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { } } + @Override public void loadCraftingRecipes(ItemStack aResult) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aResult); ArrayList<ItemStack> tResults = new ArrayList<>(); tResults.add(aResult); tResults.add(GT_OreDictUnificator.get(true, aResult)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mBlackListed) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + if (tPrefixMaterial != null && !tPrefixMaterial.mBlackListed && !tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty()) { for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tResults.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } @@ -108,7 +115,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tResults) { if (tNEIRecipe.contains(tNEIRecipe.mOutputs, tStack)) { - this.arecipes.add(tNEIRecipe); + arecipes.add(tNEIRecipe); break; } } @@ -117,13 +124,14 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe; } + @Override public void loadUsageRecipes(ItemStack aInput) { ItemData tPrefixMaterial = GT_OreDictUnificator.getAssociation(aInput); ArrayList<ItemStack> tInputs = new ArrayList<>(); tInputs.add(aInput); tInputs.add(GT_OreDictUnificator.get(false, aInput)); - if ((tPrefixMaterial != null) && (!tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty())) { + if (tPrefixMaterial != null && !tPrefixMaterial.mPrefix.mFamiliarPrefixes.isEmpty()) { for (OrePrefixes tPrefix : tPrefixMaterial.mPrefix.mFamiliarPrefixes) { tInputs.add(GT_OreDictUnificator.get(tPrefix, tPrefixMaterial.mMaterial.mMaterial, 1L)); } @@ -142,7 +150,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe = new CachedDefaultRecipe(tRecipe); for (ItemStack tStack : tInputs) { if (tNEIRecipe.contains(tNEIRecipe.mInputs, tStack)) { - this.arecipes.add(tNEIRecipe); + arecipes.add(tNEIRecipe); break; } } @@ -151,36 +159,42 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { CachedDefaultRecipe tNEIRecipe; } + @Override public String getOverlayIdentifier() { - return this.mRecipeMap.mNEIName; + return mRecipeMap.mNEIName; } + @Override public void drawBackground(int recipe) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GuiDraw.changeTexture(getGuiTexture()); GuiDraw.drawTexturedModalRect(-4, -8, 1, 3, 174, 78); } + @Override public int recipiesPerPage() { return 1; } + @Override public String getRecipeName() { - return GT_LanguageManager.getTranslation(this.mRecipeMap.mUnlocalizedName); + return GT_LanguageManager.getTranslation(mRecipeMap.mUnlocalizedName); } + @Override public String getGuiTexture() { // return "gregtech:textures/gui/" + this.mRecipeMap.mUnlocalizedName + ".png"; - return this.mRecipeMap.mNEIGUIPath; + return mRecipeMap.mNEIGUIPath; } + @Override public List<String> handleItemTooltip(GuiRecipe gui, ItemStack aStack, List<String> currenttip, int aRecipeIndex) { - CachedRecipe tObject = this.arecipes.get(aRecipeIndex); - if ((tObject instanceof CachedDefaultRecipe)) { + TemplateRecipeHandler.CachedRecipe tObject = arecipes.get(aRecipeIndex); + if (tObject instanceof CachedDefaultRecipe) { CachedDefaultRecipe tRecipe = (CachedDefaultRecipe) tObject; for (PositionedStack tStack : tRecipe.mOutputs) { if (aStack == tStack.item) { - if ((!(tStack instanceof FixedPositionedStack)) || (((FixedPositionedStack) tStack).mChance <= 0) || (((FixedPositionedStack) tStack).mChance == 10000)) { + if (!(tStack instanceof FixedPositionedStack) || ((FixedPositionedStack) tStack).mChance <= 0 || ((FixedPositionedStack) tStack).mChance == 10000) { break; } currenttip.add(trans("150","Chance: ") + ((FixedPositionedStack) tStack).mChance / 100 + "." + (((FixedPositionedStack) tStack).mChance % 100 < 10 ? "0" + ((FixedPositionedStack) tStack).mChance % 100 : Integer.valueOf(((FixedPositionedStack) tStack).mChance % 100)) + "%"); @@ -189,8 +203,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { } for (PositionedStack tStack : tRecipe.mInputs) { if (aStack == tStack.item) { - if ((gregtech.api.enums.ItemList.Display_Fluid.isStackEqual(tStack.item, true, true)) || - (tStack.item.stackSize != 0)) { + if (Display_Fluid.isStackEqual(tStack.item, true, true) || tStack.item.stackSize != 0) { break; } currenttip.add(trans("151","Does not get consumed in the process")); @@ -201,22 +214,23 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { return currenttip; } - public void drawExtras(int aRecipeIndex) { - int tEUt = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mEUt; - int computation = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mDuration; - String[] recipeDesc = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); + @Override + public void drawExtras(int aRecipeIndex) { + int tEUt = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mEUt; + int computation = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mDuration; + String[] recipeDesc = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.getNeiDesc(); if (recipeDesc == null) { - int tSpecial = ((CachedDefaultRecipe) this.arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; + int tSpecial = ((CachedDefaultRecipe) arecipes.get(aRecipeIndex)).mRecipe.mSpecialValue; short ampere=(short) (tSpecial & 0xFFFF),minComputationPerSec=(short)(tSpecial>>>16); if (tEUt != 0) { - drawText(10, 73, trans("152","Max Total: ") + ((1+((computation-minComputationPerSec)/minComputationPerSec)) * (long)tEUt * ampere * 20) + " EU", -16777216); - drawText(10, 83, trans("153","Usage: ") + ((long)tEUt*ampere) + " EU/t", -16777216); - if (this.mRecipeMap.mShowVoltageAmperageInNEI) { - drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); - drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); + drawText(10, 73, trans("152","Max Total: ") + (1+ (computation-minComputationPerSec) /minComputationPerSec) * (long)tEUt * ampere * 20 + " EU", -16777216); + drawText(10, 83, trans("153","Usage: ") + (long)tEUt*ampere + " EU/t", -16777216); + if (mRecipeMap.mShowVoltageAmperageInNEI) { + drawText(10, 93, trans("154","Voltage: ") + tEUt + " EU", -16777216); + drawText(10, 103, trans("155","Amperage: ") + ampere, -16777216); } else { - drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); - drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); + drawText(10, 93, trans("156","Voltage: unspecified"), -16777216); + drawText(10, 103, trans("157","Amperage: unspecified"), -16777216); } } drawText(10, 113, "Computation: "+computation, -16777216); @@ -224,7 +238,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { } else { int i = 0; for (String descLine : recipeDesc) { - drawText(10, 73 + 10 * i, descLine, -16777216); + drawText(10, 73 + 10 * i, descLine, -16777216); i++; } } @@ -232,6 +246,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { public static class GT_RectHandler implements IContainerInputHandler, IContainerTooltipHandler { + @Override public boolean mouseClicked(GuiContainer gui, int mousex, int mousey, int button) { if (canHandle(gui)) { if (button == 0) { @@ -244,19 +259,21 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { return false; } + @Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } public boolean canHandle(GuiContainer gui) { - return (((gui instanceof GT_GUIContainer_BasicMachine)) && (GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI)) || ((gui instanceof GT_GUIContainer_FusionReactor)) && (GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI))); + return gui instanceof GT_GUIContainer_BasicMachine && GT_Utility.isStringValid(((GT_GUIContainer_BasicMachine) gui).mNEI) || gui instanceof GT_GUIContainer_FusionReactor && GT_Utility.isStringValid(((GT_GUIContainer_FusionReactor) gui).mNEI); } + @Override public List<String> handleTooltip(GuiContainer gui, int mousex, int mousey, List<String> currenttip) { - if ((canHandle(gui)) && (currenttip.isEmpty())) { - if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + if (canHandle(gui) && currenttip.isEmpty()) { + if (gui instanceof GT_GUIContainer_BasicMachine && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); - } else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) { + } else if (gui instanceof GT_GUIContainer_FusionReactor && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1]))) { currenttip.add("Recipes"); } @@ -266,41 +283,50 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { private boolean transferRect(GuiContainer gui, boolean usage) { if (gui instanceof GT_GUIContainer_BasicMachine) { - return (canHandle(gui)) && (new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI)); + return canHandle(gui) && new Rectangle(65, 13, 36, 18).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_BasicMachine) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_BasicMachine) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1])) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_BasicMachine) gui).mNEI)); } else if (gui instanceof GT_GUIContainer_FusionReactor) { - return (canHandle(gui)) && (new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - codechicken.nei.recipe.RecipeInfo.getGuiOffset(gui)[1]))) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI)); + return canHandle(gui) && new Rectangle(145, 0, 24, 24).contains(new Point(GuiDraw.getMousePosition().x - ((GT_GUIContainer_FusionReactor) gui).getLeft() - RecipeInfo.getGuiOffset(gui)[0], GuiDraw.getMousePosition().y - ((GT_GUIContainer_FusionReactor) gui).getTop() - RecipeInfo.getGuiOffset(gui)[1])) && (usage ? GuiUsageRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI) : GuiCraftingRecipe.openRecipeGui(((GT_GUIContainer_FusionReactor) gui).mNEI)); } return false; } + @Override public List<String> handleItemDisplayName(GuiContainer gui, ItemStack itemstack, List<String> currenttip) { return currenttip; } + @Override public List<String> handleItemTooltip(GuiContainer gui, ItemStack itemstack, int mousex, int mousey, List<String> currenttip) { return currenttip; } + @Override public boolean keyTyped(GuiContainer gui, char keyChar, int keyCode) { return false; } + @Override public void onKeyTyped(GuiContainer gui, char keyChar, int keyID) { } + @Override public void onMouseClicked(GuiContainer gui, int mousex, int mousey, int button) { } + @Override public void onMouseUp(GuiContainer gui, int mousex, int mousey, int button) { } + @Override public boolean mouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { return false; } + @Override public void onMouseScrolled(GuiContainer gui, int mousex, int mousey, int scrolled) { } + @Override public void onMouseDragged(GuiContainer gui, int mousex, int mousey, int button, long heldTime) { } } @@ -315,18 +341,19 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { public FixedPositionedStack(Object object, int x, int y, int aChance) { super(object, x, y, true); - this.mChance = aChance; + mChance = aChance; } + @Override public void generatePermutations() { - if (this.permutated) { + if (permutated) { return; } ArrayList<ItemStack> tDisplayStacks = new ArrayList<>(); - for (ItemStack tStack : this.items) { + for (ItemStack tStack : items) { if (GT_Utility.isStackValid(tStack)) { if (tStack.getItemDamage() == 32767) { - List<ItemStack> permutations = codechicken.nei.ItemList.itemMap.get(tStack.getItem()); + List<ItemStack> permutations = ItemList.itemMap.get(tStack.getItem()); if (!permutations.isEmpty()) { ItemStack stack; for (Iterator i$ = permutations.iterator(); i$.hasNext(); tDisplayStacks.add(GT_Utility.copyAmount(tStack.stackSize, stack))) { @@ -342,24 +369,23 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { } } } - this.items = tDisplayStacks.toArray(new ItemStack[0]); - if (this.items.length == 0) { - this.items = new ItemStack[]{new ItemStack(Blocks.fire)}; + items = tDisplayStacks.toArray(new ItemStack[0]); + if (items.length == 0) { + items = new ItemStack[]{new ItemStack(Blocks.fire)}; } - this.permutated = true; + permutated = true; setPermutationToRender(0); } } public class CachedDefaultRecipe - extends CachedRecipe { + extends TemplateRecipeHandler.CachedRecipe { public final GT_Recipe mRecipe; public final List<PositionedStack> mOutputs; public final List<PositionedStack> mInputs; public CachedDefaultRecipe(GT_Recipe aRecipe) { - super(); - this.mRecipe = aRecipe; + mRecipe = aRecipe; mOutputs = new ArrayList<>(); mInputs = new ArrayList<>(); @@ -370,7 +396,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { // break; //case 1: if (aRecipe.getRepresentativeInput(tStartIndex) != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14+9)); + mInputs.add(new FixedPositionedStack(aRecipe.getRepresentativeInput(tStartIndex), 48, 14+9)); } //tStartIndex++; //break; @@ -567,7 +593,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { // tStartIndex++; //} if (aRecipe.mSpecialItems != null) { - this.mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); + mInputs.add(new FixedPositionedStack(aRecipe.mSpecialItems, 120, 52)); } //tStartIndex = 0; //switch (mRecipeMap.mUsualOutputCount) { @@ -575,7 +601,7 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { // break; //case 1: if (aRecipe.getOutput(tStartIndex) != null) { - this.mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14+9, aRecipe.getOutputChance(tStartIndex))); + mOutputs.add(new FixedPositionedStack(aRecipe.getOutput(tStartIndex), 102, 14+9, aRecipe.getOutputChance(tStartIndex))); } //tStartIndex++; //break; @@ -798,16 +824,19 @@ public class TT_NEI_ScannerHandler extends TemplateRecipeHandler { //} } + @Override public List<PositionedStack> getIngredients() { - return getCycledIngredients(cycleticks / 10, this.mInputs); + return getCycledIngredients(cycleticks / 10, mInputs); } + @Override public PositionedStack getResult() { return null; } + @Override public List<PositionedStack> getOtherStacks() { - return this.mOutputs; + return mOutputs; } } diff --git a/src/main/java/com/github/technus/tectech/network/Dispatcher.java b/src/main/java/com/github/technus/tectech/network/Dispatcher.java index b9b4d02fe5..cae93a7ce8 100644 --- a/src/main/java/com/github/technus/tectech/network/Dispatcher.java +++ b/src/main/java/com/github/technus/tectech/network/Dispatcher.java @@ -11,6 +11,7 @@ public class Dispatcher extends PacketDispatcher { super(Reference.MODID); } + @Override public void registerPackets() { //this.registerMessage(SpawnParticleFXMessage.SpawnParticleFXMessageHandler.class, SpawnParticleFXMessage.class); } diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 3c3ed9b845..f2296a435d 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -77,7 +77,7 @@ public class ClientProxy extends CommonProxy { boolean origFont = fontRenderer.getUnicodeFlag(); - if ((mc.gameSettings.guiScale) == 3) { + if (mc.gameSettings.guiScale == 3) { fontRenderer.setUnicodeFlag(true); float dist = 0.08F; y--; diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java index 439a28e384..df6b18838e 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipe.java @@ -41,12 +41,12 @@ public class TT_recipe extends GT_Recipe { public boolean EMisRecipeInputEqual(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap[] in, cElementalInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) return false; - if (this.eCatalyst != null) { - if (catalyst != null && catalyst.length >= this.eCatalyst.length) { - for (int i = 0; i < this.eCatalyst.length; i++) { - if (this.eCatalyst[i] != null && this.eCatalyst[i].hasStacks()) { + if (eCatalyst != null) { + if (catalyst != null && catalyst.length >= eCatalyst.length) { + for (int i = 0; i < eCatalyst.length; i++) { + if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, this.eCatalyst[i])) return false; + if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) return false; } else { return false; } @@ -80,12 +80,12 @@ public class TT_recipe extends GT_Recipe { public boolean EMisRecipeInputEqualConsumeFromOne(boolean consume, boolean doNotCheckStackSizes, ItemStack[] itemStacks, FluidStack[] fluidStacks, cElementalInstanceStackMap in, cElementalInstanceStackMap[] catalyst) { if(additionalCheck !=null && !additionalCheck.check(this,consume,doNotCheckStackSizes,itemStacks,fluidStacks,in,catalyst)) return false; - if (this.eCatalyst != null) { - if (catalyst != null && catalyst.length >= this.eCatalyst.length) { - for (int i = 0; i < this.eCatalyst.length; i++) { - if (this.eCatalyst[i] != null && this.eCatalyst[i].hasStacks()) { + if (eCatalyst != null) { + if (catalyst != null && catalyst.length >= eCatalyst.length) { + for (int i = 0; i < eCatalyst.length; i++) { + if (eCatalyst[i] != null && eCatalyst[i].hasStacks()) { if (catalyst[i] != null && catalyst[i].hasStacks()) { - if (!catalyst[i].removeAllAmounts(true, this.eCatalyst[i])) return false; + if (!catalyst[i].removeAllAmounts(true, eCatalyst[i])) return false; } else { return false; } @@ -97,10 +97,10 @@ public class TT_recipe extends GT_Recipe { } if (input != null) { if (in != null) { - for (int i = 0; i < input.length; i++) { - if (input[i] != null && input[i].hasStacks()) { + for (cElementalDefinitionStackMap anInput : input) { + if (anInput != null && anInput.hasStacks()) { if (in.hasStacks()) { - if (!in.removeAllAmounts(consume, input[i])) return false; + if (!in.removeAllAmounts(consume, anInput)) return false; } else { return false; } diff --git a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java index 629cc28dec..4c61e1fe48 100644 --- a/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java +++ b/src/main/java/com/github/technus/tectech/recipe/TT_recipeAdder.java @@ -20,7 +20,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { public static boolean addResearchableAssemblylineRecipe(ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, ItemStack[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int assDuration, int assEUt) { if(aInputs==null)aInputs=nullItem; if(aFluidInputs==null)aFluidInputs=nullFluid; - if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null) || aInputs.length>15) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null || aInputs.length>15) { return false; } for(ItemStack tItem : aInputs){ @@ -32,7 +32,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Writes Research result")}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); GT_Recipe.GT_Recipe_Map.sAssemblylineVisualRecipes.addFakeRecipe(false, aInputs, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataStick.getWithName(1L, "Reads Research result")}, aFluidInputs, null, assDuration, assEUt, 0,true); GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes.add(new GT_Recipe.GT_Recipe_AssemblyLine( aResearchItem, 0/*ignored*/, aInputs, aFluidInputs, aOutput, assDuration, assEUt)); return true; @@ -51,7 +51,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null)aInputs=nullItem; if(aFluidInputs==null)aFluidInputs=nullFluid; - if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null)) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; } for(ItemStack tItem : aInputs){ @@ -63,7 +63,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map.sMachineRecipes.add(new TT_recipe.TT_assLineRecipe(false,aResearchItem,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); return true; @@ -73,14 +73,14 @@ public class TT_recipeAdder extends GT_RecipeAdder { ItemStack aResearchItem, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.AdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { - if ((aResearchItem==null)||(totalComputationRequired<=0)||(aOutput == null)) { + if (aResearchItem==null || totalComputationRequired<=0 || aOutput == null) { return false; } if(researchAmperage<=0) researchAmperage=1; else if(researchAmperage > Short.MAX_VALUE) researchAmperage=Short.MAX_VALUE; if(computationRequiredPerSec<=0) computationRequiredPerSec=1; else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; - TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.addFakeRecipe(false, new ItemStack[]{aResearchItem}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map.sCrafterRecipes.add(new TT_recipe.TT_assLineRecipe(false,aResearchItem,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; @@ -92,7 +92,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { ItemStack aOutput, int machineDuration, int machineEUt, int machineAmperage) { if(aInputs==null)aInputs=nullItem; if(aFluidInputs==null)aFluidInputs=nullFluid; - if ((aResearchEM==null)||(totalComputationRequired<=0)||(aOutput == null)) { + if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; } for(ItemStack tItem : aInputs){ @@ -106,7 +106,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); - GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_machine.machine)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sMachineRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,aInputs,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, aFluidInputs,machineDuration,machineEUt,machineAmperage,eInputs)); return true; @@ -116,7 +116,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { iElementalDefinition aResearchEM, int totalComputationRequired, int computationRequiredPerSec, int researchEUt, int researchAmperage, cElementalDefinitionStackMap[] eInputs, cElementalDefinitionStackMap[] catalyst, TT_recipe.AdditionalCheck check, ItemStack aOutput, int crafterDuration, int crafterEUt, int crafterAmperage) { - if ((aResearchEM==null)||(totalComputationRequired<=0)||(aOutput == null)) { + if (aResearchEM==null || totalComputationRequired<=0 || aOutput == null) { return false; } if(researchAmperage<=0) researchAmperage=1; @@ -125,7 +125,7 @@ public class TT_recipeAdder extends GT_RecipeAdder { else if(computationRequiredPerSec > Short.MAX_VALUE) computationRequiredPerSec=Short.MAX_VALUE; ItemStack placeholder=new ItemStack(ElementalDefinitionContainer_EM.INSTANCE); ElementalDefinitionContainer_EM.setContent(placeholder,new cElementalDefinitionStackMap(new cElementalDefinitionStack(aResearchEM,1))); - GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage|(computationRequiredPerSec<<16)); + GT_Recipe thisRecipe=TT_recipe.GT_Recipe_MapTT.sScannableFakeRecipes.addFakeRecipe(false, new ItemStack[]{placeholder}, new ItemStack[]{aOutput}, new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Writes Research result for "+ GT_MetaTileEntity_EM_crafting.crafter)}, null, null, totalComputationRequired, researchEUt, researchAmperage| computationRequiredPerSec<<16); TT_recipe.TT_Recipe_Map_EM.sCrafterRecipesEM.add(new TT_recipe.TT_EMRecipe(false,thisRecipe,aResearchEM,null,new ItemStack[]{aOutput},new ItemStack[]{ItemList.Tool_DataOrb.getWithName(1L, "Reads Research result")}, null,crafterDuration,crafterEUt,crafterAmperage,eInputs,null,catalyst,check)); return true; diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java index c474eb4d5c..4e983bba1f 100644 --- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java +++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java @@ -55,7 +55,7 @@ public enum CustomItemList implements IItemContainer { scanContainer,parametrizerMemory; - private ItemStack mStack = null; + private ItemStack mStack; private boolean mHasNotBeenSet = true; //public static Fluid sOilExtraHeavy, sOilHeavy, sOilMedium, sOilLight, sNaturalGas; diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java index 88ad7cfbcb..44018a7392 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumGlassBlock.java @@ -24,7 +24,7 @@ public final class QuantumGlassBlock extends BlockBase { public QuantumGlassBlock() { super(Material.iron); - this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockBounds(0, 0, 0, 1, 1, 1); setBlockName("quantumGlass"); setHarvestLevel("wrench", 3); setHardness(50); @@ -59,11 +59,13 @@ public final class QuantumGlassBlock extends BlockBase { return false; } + @Override @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 1; } + @Override public boolean renderAsNormalBlock() { return false; } @@ -77,14 +79,14 @@ public final class QuantumGlassBlock extends BlockBase { @Override public int getRenderType() { - return QuantumGlassBlock.renderID; + return renderID; } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { super.registerBlockIcons(p_149651_1_); - stuff = this.blockIcon; + stuff = blockIcon; } public static void run() { diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java index 9480d28c75..bd26c838ba 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffBlock.java @@ -27,7 +27,7 @@ public final class QuantumStuffBlock extends BlockBase { public QuantumStuffBlock() { super(Material.iron); - this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockBounds(0, 0, 0, 1, 1, 1); setBlockName("quantumStuff"); setHarvestLevel("wrench", 0); setHardness(500); @@ -45,7 +45,7 @@ public final class QuantumStuffBlock extends BlockBase { @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { super.registerBlockIcons(p_149651_1_); - stuff = this.blockIcon; + stuff = blockIcon; } @Override @@ -68,15 +68,18 @@ public final class QuantumStuffBlock extends BlockBase { return false; } + @Override @SideOnly(Side.CLIENT) public int getRenderBlockPass() { return 1; } + @Override public boolean renderAsNormalBlock() { return false; } + @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) { return false; @@ -84,7 +87,7 @@ public final class QuantumStuffBlock extends BlockBase { @Override public int getRenderType() { - return QuantumStuffBlock.renderID; + return renderID; } public static void run() { diff --git a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java index 7bcc52af43..ec7f7ed0e0 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java +++ b/src/main/java/com/github/technus/tectech/thing/block/QuantumStuffRender.java @@ -52,6 +52,7 @@ public final class QuantumStuffRender implements ISimpleBlockRenderingHandler { GL11.glPopMatrix(); } + @Override public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { //renderer.renderStandardBlock(block, x, y, z); GL11.glPushMatrix(); @@ -59,7 +60,7 @@ public final class QuantumStuffRender implements ISimpleBlockRenderingHandler { tes.setBrightness(15728880); IIcon side = QuantumStuffBlock.stuff; for(int i=0;i<6;i++){ - float b = 1 - (TecTech.Rnd.nextFloat() / 4f), g = b - (TecTech.Rnd.nextFloat() / 4f), r = g - (TecTech.Rnd.nextFloat() / 4f) - 0.25f; + float b = 1 - TecTech.Rnd.nextFloat() / 4f, g = b - TecTech.Rnd.nextFloat() / 4f, r = g - TecTech.Rnd.nextFloat() / 4f - 0.25f; tes.setColorOpaque_F(r, g, b); float rotX=TecTech.Rnd.nextFloat()*2*(float) Math.PI,rotY=TecTech.Rnd.nextFloat()*2*(float) Math.PI,rotZ=TecTech.Rnd.nextFloat()*2*(float) Math.PI; tesAbuse(x,y,z,-1.425f,-1.425f,.1f,rotX,rotY,rotZ,side.getMinU(), side.getMaxV()); diff --git a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java index 2b3d78cd49..ebe5808a4a 100644 --- a/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java +++ b/src/main/java/com/github/technus/tectech/thing/block/ReactorSimBlock.java @@ -28,7 +28,7 @@ public class ReactorSimBlock extends Block implements ITileEntityProvider { public ReactorSimBlock() { super(Material.iron); - this.setBlockBounds(0, 0, 0, 1, 1, 1); + setBlockBounds(0, 0, 0, 1, 1, 1); setBlockName("reactorSim"); setHarvestLevel("wrench", 3); setHardness(50); @@ -57,7 +57,7 @@ public class ReactorSimBlock extends Block implements ITileEntityProvider { @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister p_149651_1_) { super.registerBlockIcons(p_149651_1_); - stuff = this.blockIcon; + stuff = blockIcon; } public static void run() { @@ -71,6 +71,7 @@ public class ReactorSimBlock extends Block implements ITileEntityProvider { return new ReactorSimTileEntity(); } + @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float a, float b, float c) { if(entityPlayer.isSneaking()) { return false; @@ -80,6 +81,7 @@ public class ReactorSimBlock extends Block implements ITileEntityProvider { } } + @Override public void onNeighborBlockChange(World world, int x, int y, int z, Block srcBlock) { TileEntity te = world.getTileEntity(x,y,z); if(te instanceof TileEntityBlock) { diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java index 15f9adb188..52da618bac 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_CasingsTT.java @@ -24,7 +24,7 @@ import static com.github.technus.tectech.TecTech.tectechTexturePage1; */ public class GT_Block_CasingsTT extends GT_Block_Casings_Abstract { public static final byte texturePage=tectechTexturePage1; - public final static short textureOffset = texturePage << 7;//Start of PAGE 8 (which is the 9th page) (8*128) + public static final short textureOffset = texturePage << 7;//Start of PAGE 8 (which is the 9th page) (8*128) private static IIcon eM0, eM1, eM1s, eM2, eM2s, eM3, eM3s, eM4, eM5, eM6, eM7, eM7s, eM8, eM9, eM10, eM11, eM12, eM13, eM14; private static IIcon debug[] = new IIcon[6]; @@ -118,6 +118,7 @@ public class GT_Block_CasingsTT extends GT_Block_Casings_Abstract { debug[5] = aIconRegister.registerIcon("gregtech:iconsets/DEBUG_5"); } + @Override public IIcon getIcon(int aSide, int aMeta) { switch (aMeta) { case 0: @@ -161,6 +162,7 @@ public class GT_Block_CasingsTT extends GT_Block_Casings_Abstract { } } + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); diff --git a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java index 4e4d6ba3b3..d98edd473b 100644 --- a/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java +++ b/src/main/java/com/github/technus/tectech/thing/casing/GT_Block_HintTT.java @@ -82,10 +82,12 @@ public class GT_Block_HintTT extends GT_Block_Casings_Abstract { hint[15] = aIconRegister.registerIcon(Reference.MODID+":iconsets/HINT_ERROR"); } + @Override public IIcon getIcon(int aSide, int aMeta) { return hint[aMeta]; } + @Override @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess aWorld, int xCoord, int yCoord, int zCoord, int aSide) { int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java index 0b2101d145..6e98f99790 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ConstructableTriggerItem.java @@ -37,7 +37,6 @@ public class ConstructableTriggerItem extends Item { public static HashMap<String,MultiblockInfoContainer> multiblockMap= new HashMap<>(); private ConstructableTriggerItem() { - super(); setUnlocalizedName("em.debugBuilder"); setTextureName(MODID + ":itemDebugBuilder"); } diff --git a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java index aab5d7c6b1..e8711b331a 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/DebugElementalInstanceContainer_EM.java @@ -31,7 +31,6 @@ public class DebugElementalInstanceContainer_EM extends Item { public static DebugElementalInstanceContainer_EM INSTANCE; private DebugElementalInstanceContainer_EM() { - super(); setMaxStackSize(1); setUnlocalizedName("em.debugContainer"); setTextureName(MODID + ":itemDebugContainer"); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java index 931a0a94cc..c5b2d3100e 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionContainer_EM.java @@ -24,7 +24,6 @@ public class ElementalDefinitionContainer_EM extends Item { public static ElementalDefinitionContainer_EM INSTANCE; private ElementalDefinitionContainer_EM() { - super(); setMaxStackSize(1); setUnlocalizedName("em.definitionContainer"); setTextureName(MODID + ":itemDefinitionContainer"); diff --git a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java index ef7685a938..b5250dc3d4 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ElementalDefinitionScanStorage_EM.java @@ -31,7 +31,6 @@ public class ElementalDefinitionScanStorage_EM extends Item { public static IIcon offline, online; private ElementalDefinitionScanStorage_EM() { - super(); setMaxStackSize(1); setUnlocalizedName("em.definitionScanStorage"); setTextureName(MODID + ":itemDefinitionScanStorage"); @@ -89,7 +88,7 @@ public class ElementalDefinitionScanStorage_EM extends Item { @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { offline =iconRegister.registerIcon(MODID + ":itemDefinitionScanStorageOff"); - online =this.itemIcon = iconRegister.registerIcon(this.getIconString()); + online = itemIcon = iconRegister.registerIcon(getIconString()); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java index 67fcf320f4..67e9488d3e 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java +++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java @@ -34,7 +34,6 @@ public class ParametrizerMemoryCard extends Item { public static IIcon locked,unlocked; private ParametrizerMemoryCard() { - super(); setMaxStackSize(1); setHasSubtypes(true); setUnlocalizedName("em.parametrizerMemoryCard"); @@ -50,7 +49,7 @@ public class ParametrizerMemoryCard extends Item { IMetaTileEntity metaTE = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); if (metaTE != null) { if (metaTE instanceof GT_MetaTileEntity_Hatch_Param) { - GT_MetaTileEntity_Hatch_Param parametrizer = ((GT_MetaTileEntity_Hatch_Param) metaTE); + GT_MetaTileEntity_Hatch_Param parametrizer = (GT_MetaTileEntity_Hatch_Param) metaTE; if (aStack.getTagCompound() == null) aStack.setTagCompound(new NBTTagCompound()); NBTTagCompound tNBT = aStack.getTagCompound(); if (aStack.getItemDamage() == 1) { @@ -72,7 +71,7 @@ public class ParametrizerMemoryCard extends Item { } return true; }else if(metaTE instanceof GT_MetaTileEntity_MultiblockBase_EM){ - GT_MetaTileEntity_MultiblockBase_EM base = ((GT_MetaTileEntity_MultiblockBase_EM) metaTE); + GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) metaTE; if (aStack.getTagCompound() == null) aStack.setTagCompound(new NBTTagCompound()); NBTTagCompound tNBT = aStack.getTagCompound(); if(aStack.getItemDamage()== 1){ @@ -147,8 +146,8 @@ public class ParametrizerMemoryCard extends Item { @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { - locked=iconRegister.registerIcon(MODID + ":itemParametrizerMemoryCardLocked"); - unlocked=this.itemIcon = iconRegister.registerIcon(this.getIconString()); + locked =iconRegister.registerIcon(MODID + ":itemParametrizerMemoryCardLocked"); + unlocked = itemIcon = iconRegister.registerIcon(getIconString()); } @Override diff --git a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java index c35a37a5cf..205db9b161 100644 --- a/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java +++ b/src/main/java/com/github/technus/tectech/thing/item/gui/ScanDisplayScreen.java @@ -7,7 +7,6 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; -import org.lwjgl.opengl.GL11; import static org.lwjgl.opengl.GL11.*; @@ -32,7 +31,6 @@ public class ScanDisplayScreen extends GuiScreen { private static final ResourceLocation ITEM =new ResourceLocation("tectech:textures/gui/scanDisplayItem.png"); public ScanDisplayScreen(EntityPlayer player){ - super(); lines=ElementalDefinitionScanStorage_EM.getLines(player.getHeldItem()); } @@ -40,11 +38,11 @@ public class ScanDisplayScreen extends GuiScreen { public void drawScreen(int x, int y, float partialTicks) { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - this.mc.getTextureManager().bindTexture(ITEM); + mc.getTextureManager().bindTexture(ITEM); long tick=System.currentTimeMillis()/150; int itick=(int)(tick%12); drawTexturedModalRect(baseX+99,baseY+189,32*(itick/6),32*(itick%6), 32, 32); - this.mc.getTextureManager().bindTexture(BACKGROUNDS[(int)(tick%8)]); + mc.getTextureManager().bindTexture(BACKGROUNDS[(int)(tick%8)]); drawTexturedModalRect(baseX,baseY,0,0, sizeX, sizeY); glDisable(GL_BLEND); super.drawScreen(x,y,partialTicks); @@ -62,7 +60,7 @@ public class ScanDisplayScreen extends GuiScreen { TecTech.proxy.renderUnicodeString(lines[i], textBaseX, textBaseY - 8 + j, 200, itick); } } - for(int i=firstLine, j=0;i<lines.length && j<renderedLines;i++,j++){ + for(int i = firstLine, j = 0; i<lines.length && j< renderedLines; i++,j++){ textBaseY += 9; int equalPos=lines[i].indexOf('='); if(equalPos>=0){ @@ -72,7 +70,7 @@ public class ScanDisplayScreen extends GuiScreen { TecTech.proxy.renderUnicodeString(lines[i], textBaseX, textBaseY, 200, itick); } } - for(int i=firstLine+renderedLines, j=8;i<lines.length && j!=0;i++,j/=2){ + for(int i = firstLine+ renderedLines, j = 8; i<lines.length && j!=0; i++,j/=2){ int equalPos=lines[i].indexOf('='); if(equalPos>=0){ TecTech.proxy.renderUnicodeString(lines[i].substring(0,equalPos), textBaseX, textBaseY + 17 - j, 200, itick); @@ -90,13 +88,13 @@ public class ScanDisplayScreen extends GuiScreen { @Override public void initGui() { - baseX=(width-sizeX)/2; - baseY=(height-sizeY)/2-12; + baseX=(width- sizeX)/2; + baseY=(height- sizeY)/2-12; int buttonBaseY=baseY+145; - this.buttonList.add(pgUp=new Button(0,baseX+77,buttonBaseY,0,220)); - this.buttonList.add(up=new Button(1,baseX+99,buttonBaseY,20,220)); - this.buttonList.add(down=new Button(2,baseX+121,buttonBaseY,40,220)); - this.buttonList.add(pgDown=new Button(3,baseX+143,buttonBaseY,60,220)); + buttonList.add(pgUp=new Button(0,baseX+77,buttonBaseY,0,220)); + buttonList.add(up=new Button(1,baseX+99,buttonBaseY,20,220)); + buttonList.add(down=new Button(2,baseX+121,buttonBaseY,40,220)); + buttonList.add(pgDown=new Button(3,baseX+143,buttonBaseY,60,220)); } @Override @@ -126,15 +124,15 @@ public class ScanDisplayScreen extends GuiScreen { @Override public void drawButton(Minecraft mc, int xPos, int yPos) { - if (this.visible) + if (visible) { - this.field_146123_n = xPos >= this.xPosition && yPos >= this.yPosition && xPos < this.xPosition + this.width && yPos < this.yPosition + this.height; + field_146123_n = xPos >= xPosition && yPos >= yPosition && xPos < xPosition + width && yPos < yPosition + height; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); mc.getTextureManager().bindTexture(BACKGROUNDS[0]); - drawTexturedModalRect(this.xPosition, this.yPosition, u + this.getHoverState(this.field_146123_n) * 80, v, this.width, this.height); + drawTexturedModalRect(xPosition, yPosition, u + getHoverState(field_146123_n) * 80, v, width, height); glDisable(GL_BLEND); - GL11.glEnable(GL11.GL_BLEND); + glEnable(GL_BLEND); } } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java index ec580f3668..9a51b0278e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_ElementalContainer.java @@ -1,6 +1,5 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.core.iElementalInstanceContainer; @@ -120,7 +119,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 0); if (tGTTileEntity == null || !(tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) tGTTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide((byte) 1); - if (tGTTileEntity != null && (tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental)) { + if (tGTTileEntity != null && tGTTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_OverflowElemental) { GT_MetaTileEntity_Hatch_OverflowElemental aMetaTileEntity = (GT_MetaTileEntity_Hatch_OverflowElemental) tGTTileEntity.getMetaTileEntity(); if (aMetaTileEntity.addOverflowMatter(overflowMatter)) { if (TecTech.ModConfig.BOOM_ENABLE) tGTTileEntity.doExplosion(V[14]); @@ -217,8 +216,8 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta if (content == null || content.size() == 0) return new String[]{"ID: " + EnumChatFormatting.AQUA + id, "No Stacks"}; else { - final String[] lines = content.getElementalInfo(); - final String[] output = new String[lines.length + 1]; + String[] lines = content.getElementalInfo(); + String[] output = new String[lines.length + 1]; output[0] = "ID: " + EnumChatFormatting.AQUA + id; System.arraycopy(lines, 0, output, 1, lines.length); return output; @@ -245,7 +244,7 @@ public abstract class GT_MetaTileEntity_Hatch_ElementalContainer extends GT_Meta @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_EM, + TEC_MARK_EM, mDescription, "Max stacks amount: " + EnumChatFormatting.AQUA + getMaxStacksCount(), "Stack capacity: " + EnumChatFormatting.AQUA + getMaxStackSize(), diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java index d468474d2f..65b2b084b2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_OverflowElemental.java @@ -23,6 +23,8 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.common.util.ForgeDirection; +import java.util.Locale; + import static com.github.technus.tectech.CommonValues.DISPERSE_AT; import static com.github.technus.tectech.Util.V; import static com.github.technus.tectech.loader.MainLoader.elementalPollution; @@ -91,8 +93,8 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity return new String[]{ CommonValues.TEC_MARK_EM, mDescription, - "Mass capacity: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", - "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(java.util.Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", + "Mass capacity: " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowMax) + " eV/c\u00b2", + "Disposal Speed: " + EnumChatFormatting.AQUA + String.format(Locale.ENGLISH, "%+.2E", overflowDisperse) + " (eV/c\u00b2)/s", "DO NOT OBSTRUCT THE OUTPUT!" }; } @@ -146,7 +148,7 @@ public class GT_MetaTileEntity_Hatch_OverflowElemental extends GT_MetaTileEntity @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - if (aBaseMetaTileEntity.isServerSide() && (aTick % 20) == DISPERSE_AT) { + if (aBaseMetaTileEntity.isServerSide() && aTick % 20 == DISPERSE_AT) { if (aBaseMetaTileEntity.isActive()) { if (overflowMatter > overflowDisperse) { //todo add full dose of dispersed pollution (reduced by tier, or make recycler machine only capable of reduction?) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java index 6c25fb3173..98dc1038dc 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Param.java @@ -136,6 +136,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { return false; } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setBoolean("eFloats", usesFloat); @@ -147,6 +148,7 @@ public class GT_MetaTileEntity_Hatch_Param extends GT_MetaTileEntity_Hatch { aNBT.setInteger("eParam", param); } + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); usesFloat = aNBT.getBoolean("eFloats"); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java index 4494316391..fb7f62b8cf 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Rack.java @@ -150,7 +150,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { mInventory[i] = null; continue; } else if (comp.subZero || this.heat >= 0) { - heat += (1f + (comp.coEff * this.heat / 10000f)) * (comp.heat > 0 ? comp.heat * overclock * overclock * overvolt : comp.heat); + heat += (1f + comp.coEff * this.heat / 10000f) * (comp.heat > 0 ? comp.heat * overclock * overclock * overvolt : comp.heat); //=MAX(0;MIN(MIN($B4;1*C$3+C$3-0,25);1+RAND()+(C$3-1)-($B4-1)/2)) if (overvolt * 10f > 7f + TecTech.Rnd.nextFloat()) computation += comp.computation * Math.max(0, Math.min(Math.min(overclock, overvolt + overvolt - 0.25), 1 + TecTech.Rnd.nextFloat() + (overvolt - 1) - (overclock - 1) / 2)); @@ -181,19 +181,19 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isServerSide()) { if (aTick % 20 == MULTI_CHECK_AT) { - if (this.heat > 0) { + if (heat > 0) { float heatC = 0; for (int i = 0; i < mInventory.length; i++) { if (mInventory[i] == null || mInventory[i].stackSize != 1) continue; rackComponent comp = componentBinds.get(getUniqueIdentifier(mInventory[i])); if (comp == null) continue; - if (this.heat > comp.maxHeat) { + if (heat > comp.maxHeat) { mInventory[i] = null; } else if (comp.heat < 0) { - heatC += comp.heat * (this.heat / 10000); + heatC += comp.heat * (heat / 10000); } } - this.heat += Math.max(-this.heat, Math.ceil(heatC)); + heat += Math.max(-heat, Math.ceil(heatC)); } if (heat > 0) heat -= Math.max(heat / 1000, 1); @@ -201,7 +201,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { if (heat > 9000) aBaseMetaTileEntity.setOnFire(); else if (heat > 10000) aBaseMetaTileEntity.setToFire(); - else if (heat < -10000) this.heat = -10000; + else if (heat < -10000) heat = -10000; } } } @@ -237,7 +237,7 @@ public class GT_MetaTileEntity_Hatch_Rack extends GT_MetaTileEntity_Hatch { return new String[]{ "Base computation: " + EnumChatFormatting.AQUA + getComputationPower(1, 0, false), "After overclocking: " + EnumChatFormatting.AQUA + getComputationPower(overClock, 0, false), - "Heat Accumulated: " + EnumChatFormatting.RED + ((heat + 99) / 100) + EnumChatFormatting.RESET + " %"}; + "Heat Accumulated: " + EnumChatFormatting.RED + (heat + 99) / 100 + EnumChatFormatting.RESET + " %"}; //heat==0? --> ((heat+9)/10) = 0 //Heat==1-10? --> 1 } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java index 81f05fad7c..8fba255ff2 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/GT_MetaTileEntity_Hatch_Uncertainty.java @@ -115,6 +115,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch return false; } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setByte("mSel", selection); @@ -126,6 +127,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch aNBT.setTag("mMat", mat); } + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); selection = aNBT.getByte("mSel"); @@ -182,7 +184,7 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch for (int i = 0; i < masses.length >> 1; i++) { inequality += Math.abs(masses[i] - masses[masses.length - i - 1]); } - return inequality < (masses.length << 7); + return inequality < masses.length << 7; } public void regenerate() { @@ -260,8 +262,8 @@ public class GT_MetaTileEntity_Hatch_Uncertainty extends GT_MetaTileEntity_Hatch } private void shift() { - final int i = TecTech.Rnd.nextInt(16), j = TecTech.Rnd.nextInt(128); - matrix[i] += (((matrix[i] & 1) == 0) ? 2 : -2) * j >> 5; + int i = TecTech.Rnd.nextInt(16), j = TecTech.Rnd.nextInt(128); + matrix[i] += ((matrix[i] & 1) == 0 ? 2 : -2) * j >> 5; matrix[i] += j == 0 ? 1 : 0; if (matrix[i] < 0) matrix[i] = 0; else if (matrix[i] > 1000) matrix[i] = 999; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java index ca1ef49fe2..9c1a85c373 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Holder.java @@ -15,14 +15,17 @@ public class GT_Container_Holder extends GT_ContainerMetaTile_Machine { super(aInventoryPlayer, aTileEntity); } + @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 39)); + addSlotToContainer(new Slot(mTileEntity, 0, 80, 39)); } + @Override public int getSlotCount() { return 1; } + @Override public int getShiftClickSlotCount() { return 1; } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java index 3a6d4b74fa..03eddca2cb 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Param.java @@ -27,25 +27,25 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); } @Override @@ -53,58 +53,58 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { if (aSlotIndex < 0) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); boolean doStuff = true; - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { + GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity(); switch (aSlotIndex) { case 0: - paramH.param -= (aShifthold == 1 ? 16 : 4); + paramH.param -= aShifthold == 1 ? 16 : 4; break; case 1: - paramH.value0i -= (aShifthold == 1 ? 4096 : 256); + paramH.value0i -= aShifthold == 1 ? 4096 : 256; break; case 2: - paramH.value1i -= (aShifthold == 1 ? 4096 : 256); + paramH.value1i -= aShifthold == 1 ? 4096 : 256; break; case 3: paramH.value0i >>= aShifthold == 1 ? 16 : 4; paramH.value1i >>= aShifthold == 1 ? 16 : 4; break; case 4: - paramH.param -= (aShifthold == 1 ? 2 : 1); + paramH.param -= aShifthold == 1 ? 2 : 1; break; case 5: - paramH.value0i -= (aShifthold == 1 ? 16 : 1); + paramH.value0i -= aShifthold == 1 ? 16 : 1; break; case 6: - paramH.value1i -= (aShifthold == 1 ? 16 : 1); + paramH.value1i -= aShifthold == 1 ? 16 : 1; break; case 7: paramH.value0i >>= aShifthold == 1 ? 2 : 1; paramH.value1i >>= aShifthold == 1 ? 2 : 1; break; case 8: - paramH.param += (aShifthold == 1 ? 16 : 4); + paramH.param += aShifthold == 1 ? 16 : 4; break; case 9: - paramH.value0i += (aShifthold == 1 ? 4096 : 256); + paramH.value0i += aShifthold == 1 ? 4096 : 256; break; case 10: - paramH.value1i += (aShifthold == 1 ? 4096 : 256); + paramH.value1i += aShifthold == 1 ? 4096 : 256; break; case 11: paramH.value0i <<= aShifthold == 1 ? 16 : 4; paramH.value1i <<= aShifthold == 1 ? 16 : 4; break; case 12: - paramH.param += (aShifthold == 1 ? 2 : 1); + paramH.param += aShifthold == 1 ? 2 : 1; break; case 13: - paramH.value0i += (aShifthold == 1 ? 16 : 1); + paramH.value0i += aShifthold == 1 ? 16 : 1; break; case 14: - paramH.value1i += (aShifthold == 1 ? 16 : 1); + paramH.value1i += aShifthold == 1 ? 16 : 1; break; case 15: paramH.value0i <<= aShifthold == 1 ? 2 : 1; @@ -124,64 +124,64 @@ public class GT_Container_Param extends GT_ContainerMetaTile_Machine { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } - this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; - this.value0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value0i; - this.value1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1i; - this.input0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input0i; - this.input1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1i; + param = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).param; + value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0i; + value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1i; + input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0i; + input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1i; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); - var1.sendProgressBarUpdate(this, 101, this.param >>> 16); - var1.sendProgressBarUpdate(this, 102, this.value0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.value0f >>> 16); - var1.sendProgressBarUpdate(this, 104, this.value1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, this.value1f >>> 16); - var1.sendProgressBarUpdate(this, 106, this.input0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, this.input0f >>> 16); - var1.sendProgressBarUpdate(this, 108, this.input1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, this.input1f >>> 16); + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 100, param & 0xFFFF); + var1.sendProgressBarUpdate(this, 101, param >>> 16); + var1.sendProgressBarUpdate(this, 102, value0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, value0f >>> 16); + var1.sendProgressBarUpdate(this, 104, value1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 105, value1f >>> 16); + var1.sendProgressBarUpdate(this, 106, input0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 107, input0f >>> 16); + var1.sendProgressBarUpdate(this, 108, input1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 109, input1f >>> 16); } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 100: - this.param = (this.param & 0xFFFF0000 | par2); + param = param & 0xFFFF0000 | par2; return; case 101: - this.param = (this.param & 0xFFFF | (par2 << 16)); + param = param & 0xFFFF | par2 << 16; return; case 102: - this.value0f = (this.value0f & 0xFFFF0000 | par2); + value0f = value0f & 0xFFFF0000 | par2; break; case 103: - this.value0f = (this.value0f & 0xFFFF | (par2 << 16)); + value0f = value0f & 0xFFFF | par2 << 16; break; case 104: - this.value1f = (this.value1f & 0xFFFF0000 | par2); + value1f = value1f & 0xFFFF0000 | par2; break; case 105: - this.value1f = (this.value1f & 0xFFFF | (par2 << 16)); + value1f = value1f & 0xFFFF | par2 << 16; break; case 106: - this.input0f = (this.input0f & 0xFFFF0000 | par2); + input0f = input0f & 0xFFFF0000 | par2; break; case 107: - this.input0f = (this.input0f & 0xFFFF | (par2 << 16)); + input0f = input0f & 0xFFFF | par2 << 16; break; case 108: - this.input1f = (this.input1f & 0xFFFF0000 | par2); + input1f = input1f & 0xFFFF0000 | par2; return; case 109: - this.input1f = (this.input1f & 0xFFFF | (par2 << 16)); + input1f = input1f & 0xFFFF | par2 << 16; return; default: } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java index 2c4670e52f..2eb44ad72a 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_ParamAdv.java @@ -29,25 +29,25 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); } @Override @@ -55,23 +55,23 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { if (aSlotIndex < 0) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); boolean doStuff = true; - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity(); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { + GT_MetaTileEntity_Hatch_Param paramH = (GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity(); int columnPointer=paramH.pointer &0xff; boolean secondRow=(paramH.pointer &0x0100)!=0; boolean showInts=!paramH.isUsingFloats(); switch (aSlotIndex) { case 0: - paramH.param -= (aShifthold == 1 ? 16 : 4); + paramH.param -= aShifthold == 1 ? 16 : 4; break; case 1: if (secondRow) secondRow = false; - else columnPointer -= (aShifthold == 1 ? 16 : 4); + else columnPointer -= aShifthold == 1 ? 16 : 4; break; case 2: - if (secondRow) columnPointer -= (aShifthold == 1 ? 16 : 4); + if (secondRow) columnPointer -= aShifthold == 1 ? 16 : 4; else secondRow = true; break; case 3: @@ -84,14 +84,14 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { } break; case 4: - paramH.param -= (aShifthold == 1 ? 2 : 1); + paramH.param -= aShifthold == 1 ? 2 : 1; break; case 5: if (secondRow) secondRow = false; - else columnPointer -= (aShifthold == 1 ? 2 : 1); + else columnPointer -= aShifthold == 1 ? 2 : 1; break; case 6: - if (secondRow) columnPointer -= (aShifthold == 1 ? 2 : 1); + if (secondRow) columnPointer -= aShifthold == 1 ? 2 : 1; else secondRow = true; break; case 7: @@ -104,28 +104,28 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { } break; case 8: - paramH.param += (aShifthold == 1 ? 16 : 4); + paramH.param += aShifthold == 1 ? 16 : 4; break; case 9: if (secondRow) secondRow = false; - else columnPointer += (aShifthold == 1 ? 16 : 4); + else columnPointer += aShifthold == 1 ? 16 : 4; break; case 10: - if (secondRow) columnPointer += (aShifthold == 1 ? 16 : 4); + if (secondRow) columnPointer += aShifthold == 1 ? 16 : 4; else secondRow = true; break; case 11: showInts ^= true; break; case 12: - paramH.param += (aShifthold == 1 ? 2 : 1); + paramH.param += aShifthold == 1 ? 2 : 1; break; case 13: if (secondRow) secondRow = false; - else columnPointer += (aShifthold == 1 ? 2 : 1); + else columnPointer += aShifthold == 1 ? 2 : 1; break; case 14: - if (secondRow) columnPointer += (aShifthold == 1 ? 2 : 1); + if (secondRow) columnPointer += aShifthold == 1 ? 2 : 1; else secondRow = true; break; case 15: @@ -155,71 +155,71 @@ public class GT_Container_ParamAdv extends GT_ContainerMetaTile_Machine { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } - this.param = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).param; - this.value0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value0i; - this.value1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).value1i; - this.input0f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input0i; - this.input1f = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).input1i; - this.pointer = ((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).pointer; - this.usesFloats =((GT_MetaTileEntity_Hatch_Param) this.mTileEntity.getMetaTileEntity()).isUsingFloats(); + param = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).param; + value0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value0i; + value1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).value1i; + input0f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input0i; + input1f = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).input1i; + pointer = ((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).pointer; + usesFloats =((GT_MetaTileEntity_Hatch_Param) mTileEntity.getMetaTileEntity()).isUsingFloats(); - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.param & 0xFFFF); - var1.sendProgressBarUpdate(this, 101, this.param >>> 16); - var1.sendProgressBarUpdate(this, 102, this.value0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 103, this.value0f >>> 16); - var1.sendProgressBarUpdate(this, 104, this.value1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 105, this.value1f >>> 16); - var1.sendProgressBarUpdate(this, 106, this.input0f & 0xFFFF); - var1.sendProgressBarUpdate(this, 107, this.input0f >>> 16); - var1.sendProgressBarUpdate(this, 108, this.input1f & 0xFFFF); - var1.sendProgressBarUpdate(this, 109, this.input1f >>> 16); - var1.sendProgressBarUpdate(this, 110, this.usesFloats?this.pointer+0x10000:this.pointer); + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 100, param & 0xFFFF); + var1.sendProgressBarUpdate(this, 101, param >>> 16); + var1.sendProgressBarUpdate(this, 102, value0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 103, value0f >>> 16); + var1.sendProgressBarUpdate(this, 104, value1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 105, value1f >>> 16); + var1.sendProgressBarUpdate(this, 106, input0f & 0xFFFF); + var1.sendProgressBarUpdate(this, 107, input0f >>> 16); + var1.sendProgressBarUpdate(this, 108, input1f & 0xFFFF); + var1.sendProgressBarUpdate(this, 109, input1f >>> 16); + var1.sendProgressBarUpdate(this, 110, usesFloats ? pointer + 0x10000 : pointer); } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 100: - this.param = (this.param & 0xFFFF0000 | par2); + param = param & 0xFFFF0000 | par2; return; case 101: - this.param = (this.param & 0xFFFF | (par2 << 16)); + param = param & 0xFFFF | par2 << 16; return; case 102: - this.value0f = (this.value0f & 0xFFFF0000 | par2); + value0f = value0f & 0xFFFF0000 | par2; break; case 103: - this.value0f = (this.value0f & 0xFFFF | (par2 << 16)); + value0f = value0f & 0xFFFF | par2 << 16; break; case 104: - this.value1f = (this.value1f & 0xFFFF0000 | par2); + value1f = value1f & 0xFFFF0000 | par2; break; case 105: - this.value1f = (this.value1f & 0xFFFF | (par2 << 16)); + value1f = value1f & 0xFFFF | par2 << 16; break; case 106: - this.input0f = (this.input0f & 0xFFFF0000 | par2); + input0f = input0f & 0xFFFF0000 | par2; break; case 107: - this.input0f = (this.input0f & 0xFFFF | (par2 << 16)); + input0f = input0f & 0xFFFF | par2 << 16; break; case 108: - this.input1f = (this.input1f & 0xFFFF0000 | par2); + input1f = input1f & 0xFFFF0000 | par2; return; case 109: - this.input1f = (this.input1f & 0xFFFF | (par2 << 16)); + input1f = input1f & 0xFFFF | par2 << 16; return; case 110: - this.pointer = par2 & 0xFFFF; - this.usesFloats=par2>=0x10000; + pointer = par2 & 0xFFFF; + usesFloats =par2>=0x10000; default: } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java index 87bedcb3dd..350e508c6e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Rack.java @@ -23,17 +23,20 @@ public class GT_Container_Rack extends GT_ContainerMetaTile_Machine { super(aInventoryPlayer, aTileEntity); } + @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - this.addSlotToContainer(new Slot(this.mTileEntity, 0, 69, 28)); - this.addSlotToContainer(new Slot(this.mTileEntity, 1, 91, 28)); - this.addSlotToContainer(new Slot(this.mTileEntity, 2, 69, 50)); - this.addSlotToContainer(new Slot(this.mTileEntity, 3, 91, 50)); + addSlotToContainer(new Slot(mTileEntity, 0, 69, 28)); + addSlotToContainer(new Slot(mTileEntity, 1, 91, 28)); + addSlotToContainer(new Slot(mTileEntity, 2, 69, 50)); + addSlotToContainer(new Slot(mTileEntity, 3, 91, 50)); } + @Override public int getSlotCount() { return 4; } + @Override public int getShiftClickSlotCount() { return 4; } @@ -41,24 +44,24 @@ public class GT_Container_Rack extends GT_ContainerMetaTile_Machine { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } - this.heat = ((GT_MetaTileEntity_Hatch_Rack) this.mTileEntity.getMetaTileEntity()).heat > 0; + heat = ((GT_MetaTileEntity_Hatch_Rack) mTileEntity.getMetaTileEntity()).heat > 0; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.heat ? 1 : 0); + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 100, heat ? 1 : 0); } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 100: - this.heat = par2 != 0; + heat = par2 != 0; return; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java index 8db5fc1aa4..768ed48f2e 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_Container_Uncertainty.java @@ -24,25 +24,25 @@ public class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); - - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); + + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); } @Override @@ -50,12 +50,12 @@ public class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { if (aSlotIndex < 0) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_Hatch_Uncertainty catH = (GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity(); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { + GT_MetaTileEntity_Hatch_Uncertainty catH = (GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity(); if (aSlotIndex < 16 && catH.matrix != null) { if (catH.selection == -1) { - catH.selection = (byte) (aSlotIndex); + catH.selection = (byte) aSlotIndex; } else { short temp = catH.matrix[catH.selection]; catH.matrix[catH.selection] = catH.matrix[aSlotIndex]; @@ -71,49 +71,48 @@ public class GT_Container_Uncertainty extends GT_ContainerMetaTile_Machine { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } - ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).compute(); + ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).compute(); - if (this.matrix != null) + if (matrix != null) for (int i = 0; i < 16; i++) - this.matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).matrix[i]; - - this.selection = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).selection; - this.mode = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).mode; - this.status = ((GT_MetaTileEntity_Hatch_Uncertainty) this.mTileEntity.getMetaTileEntity()).status; - - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); - var1.sendProgressBarUpdate(this, 100, this.selection); - var1.sendProgressBarUpdate(this, 101, this.mode); - var1.sendProgressBarUpdate(this, 102, this.status); - - if (this.matrix != null) - for (int i = 0; i < 16; i++) - var1.sendProgressBarUpdate(this, 103 + i, this.matrix[i]); + matrix[i] = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).matrix[i]; + + selection = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).selection; + mode = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).mode; + status = ((GT_MetaTileEntity_Hatch_Uncertainty) mTileEntity.getMetaTileEntity()).status; + + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; + var1.sendProgressBarUpdate(this, 100, selection); + var1.sendProgressBarUpdate(this, 101, mode); + var1.sendProgressBarUpdate(this, 102, status); + + if (matrix != null) for (int i = 0; i < 16; i++) + var1.sendProgressBarUpdate(this, 103 + i, matrix[i]); } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 100: - this.selection = (byte) par2; + selection = (byte) par2; break; case 101: - this.mode = (byte) par2; + mode = (byte) par2; break; case 102: - this.status = (byte) par2; + status = (byte) par2; break; default: if (matrix != null && par1 >= 103 && par1 < 119) { - this.matrix[par1 - 103] = (short) par2; + matrix[par1 - 103] = (short) par2; break; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java index 596d8f5420..ec62e2c16f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Holder.java @@ -12,19 +12,21 @@ public class GT_GUIContainer_Holder extends GT_GUIContainerMetaTile_Machine { public GT_GUIContainer_Holder(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_Holder(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/holder.png"); - this.mName = aName; + mName = aName; } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString(this.mName, 8, 4, 4210752); + fontRendererObj.drawString(mName, 8, 4, 4210752); } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + if (mContainer != null) { if (((GT_Container_Holder) mContainer).mActive == 1) drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java index 4a7d25c95a..d9502333d8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Param.java @@ -15,25 +15,27 @@ public class GT_GUIContainer_Param extends GT_GUIContainerMetaTile_Machine { super(new GT_Container_Param(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Parametrizer.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - if (this.mContainer != null) { - proxy.renderUnicodeString("Parameters: " + ((GT_Container_Param) this.mContainer).param, 46, 7, 167, 0xffffff); - Locale locale=java.util.Locale.getDefault(); - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).input0f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).input1f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).value0f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) this.mContainer).value1f), 46, 41, 167, 0x0077ff); - proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_Param) this.mContainer).value0f), 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_Param) this.mContainer).value1f), 46, 58, 167, 0x0077ff); + if (mContainer != null) { + proxy.renderUnicodeString("Parameters: " + ((GT_Container_Param) mContainer).param, 46, 7, 167, 0xffffff); + Locale locale= Locale.getDefault(); + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).input0f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).input1f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).value0f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_Param) mContainer).value1f), 46, 41, 167, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_Param) mContainer).value0f), 46, 50, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_Param) mContainer).value1f), 46, 58, 167, 0x0077ff); } else { proxy.renderUnicodeString("Parameters", 46, 7, 167, 0xffffff); } } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java index 8e34664919..245ec91b20 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_ParamAdv.java @@ -15,33 +15,35 @@ public class GT_GUIContainer_ParamAdv extends GT_GUIContainerMetaTile_Machine { super(new GT_Container_ParamAdv(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "ParametrizerAdv.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - if (this.mContainer != null) { - proxy.renderUnicodeString("Parameters X: " + ((GT_Container_ParamAdv) this.mContainer).param, 46, 7, 167, 0xffffff); - Locale locale=java.util.Locale.getDefault(); - if (((GT_Container_ParamAdv) this.mContainer).usesFloats) { - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).input0f)), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).input1f)), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).value0f)), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) this.mContainer).value1f)), 46, 41, 167, 0x0077ff); + if (mContainer != null) { + proxy.renderUnicodeString("Parameters X: " + ((GT_Container_ParamAdv) mContainer).param, 46, 7, 167, 0xffffff); + Locale locale= Locale.getDefault(); + if (((GT_Container_ParamAdv) mContainer).usesFloats) { + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).input0f)), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).input1f)), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).value0f)), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+.5E", Float.intBitsToFloat(((GT_Container_ParamAdv) mContainer).value1f)), 46, 41, 167, 0x0077ff); } else { - proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).input0f), 46, 16, 167, 0x22ddff); - proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).input1f), 46, 24, 167, 0x00ffff); - proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).value0f), 46, 33, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) this.mContainer).value1f), 46, 41, 167, 0x0077ff); + proxy.renderUnicodeString("\u24EA\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).input0f), 46, 16, 167, 0x22ddff); + proxy.renderUnicodeString("\u2460\u2b07" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).input1f), 46, 24, 167, 0x00ffff); + proxy.renderUnicodeString("\u24EA\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).value0f), 46, 33, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + String.format(locale, "%+d", ((GT_Container_ParamAdv) mContainer).value1f), 46, 41, 167, 0x0077ff); } - proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) this.mContainer).value0f), 46, 50, 167, 0x00bbff); - proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) this.mContainer).value1f), 46, 58, 167, 0x0077ff); - proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) this.mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); + proxy.renderUnicodeString("\u24EA\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) mContainer).value0f), 46, 50, 167, 0x00bbff); + proxy.renderUnicodeString("\u2460\u2b06" + Util.intBitsToShortString(((GT_Container_ParamAdv) mContainer).value1f), 46, 58, 167, 0x0077ff); + proxy.renderUnicodeString("Pointer " + Integer.toHexString(((GT_Container_ParamAdv) mContainer).pointer | 0x10000).substring(1), 46, 66, 167, 0x0033ff); } else { proxy.renderUnicodeString("Parameters X", 46, 7, 167, 0xffffff); } } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java index e4dc042772..42b74da7b8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Rack.java @@ -12,19 +12,21 @@ public class GT_GUIContainer_Rack extends GT_GUIContainerMetaTile_Machine { public GT_GUIContainer_Rack(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { super(new GT_Container_Rack(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/rack.png"); - this.mName = aName; + mName = aName; } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString(this.mName, 8, 4, 4210752); + fontRendererObj.drawString(mName, 8, 4, 4210752); } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null) { + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + if (mContainer != null) { if (((GT_Container_Rack) mContainer).mActive == 1) drawTexturedModalRect(x + 151, y + 23, 183, 23, 18, 18); if (((GT_Container_Rack) mContainer).heat) diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java index 19826984c3..d70ed025df 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_Uncertainty.java @@ -14,26 +14,28 @@ public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { proxy.renderUnicodeString("Schr\u00F6dinger", 46, 7, 167, 0xffffff); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) + if (mContainer != null && ((GT_Container_Uncertainty) mContainer).status == 0) proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); else proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + if (mContainer != null && ((GT_Container_Uncertainty) mContainer).matrix != null) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - final short bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; + short bU = 0, rU = 70, fU = 192, V = 210, Vs = 216; x += 52; y += 33; - final int state = ((GT_Container_Uncertainty) this.mContainer).status; - switch (((GT_Container_Uncertainty) this.mContainer).mode) { + int state = ((GT_Container_Uncertainty) mContainer).status; + switch (((GT_Container_Uncertainty) mContainer).mode) { case 1://ooo oxo ooo drawTexturedModalRect(x + 12, y + 12, rU + (state == 0 ? 76 : 12), @@ -96,11 +98,11 @@ public class GT_GUIContainer_Uncertainty extends GT_GUIContainerMetaTile_Machine x -= 6; y -= 6; for (int i = 0; i < 16; i++) - if (TecTech.Rnd.nextInt(1000) < ((GT_Container_Uncertainty) this.mContainer).matrix[i]) + if (TecTech.Rnd.nextInt(1000) < ((GT_Container_Uncertainty) mContainer).matrix[i]) drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); - if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) this.mContainer).selection; + if (((GT_Container_Uncertainty) mContainer).selection > -1) { + int sel = ((GT_Container_Uncertainty) mContainer).selection; drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java index d6a0b14f34..6c0a4ce038 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/hatch/gui/GT_GUIContainer_UncertaintyAdv.java @@ -3,7 +3,6 @@ package com.github.technus.tectech.thing.metaTileEntity.hatch.gui; import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import net.minecraft.entity.player.InventoryPlayer; -import org.lwjgl.opengl.GL11; import static com.github.technus.tectech.TecTech.proxy; import static gregtech.api.enums.GT_Values.RES_PATH_GUI; @@ -16,82 +15,52 @@ public class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Mach super(new GT_Container_Uncertainty(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Uncertainty.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { proxy.renderUnicodeString("Schr\u00F6dinger X", 46, 7, 167, 0xffffff); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).status == 0) + if (mContainer != null && ((GT_Container_Uncertainty) mContainer).status == 0) proxy.renderUnicodeString("Status: OK", 46, 16, 167, 0xffffff); else proxy.renderUnicodeString("Status: NG", 46, 16, 167, 0xffffff); } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - if (this.mContainer != null && ((GT_Container_Uncertainty) this.mContainer).matrix != null) { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + if (mContainer != null && ((GT_Container_Uncertainty) mContainer).matrix != null) { + glColor4f(1.0F, 1.0F, 1.0F, 1.0F); x += sX; y += sY; - final int state = ((GT_Container_Uncertainty) this.mContainer).status; - switch (((GT_Container_Uncertainty) this.mContainer).mode) { + int state = ((GT_Container_Uncertainty) mContainer).status; + switch (((GT_Container_Uncertainty) mContainer).mode) { case 1://ooo oxo ooo - drawTexturedModalRect(x + 12, y + 12, - rU + (state == 0 ? 76 : 12), - Vs + 12, 10, 10); + drawTexturedModalRect(x + 12, y + 12, rU + (state == 0 ? 76 : 12), Vs + 12, 10, 10); break; case 2://ooo xox ooo - drawTexturedModalRect(x, y + 12, - rU + ((state & 1) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 2) == 0 ? 88 : 24), - Vs + 12, 10, 10); + drawTexturedModalRect(x, y + 12, rU + ((state & 1) == 0 ? 64 : 0), Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, rU + ((state & 2) == 0 ? 88 : 24), Vs + 12, 10, 10); break; case 3://oxo xox oxo - drawTexturedModalRect(x + 12, y, - rU + ((state & 1) == 0 ? 76 : 12), - Vs, 10, 10); - drawTexturedModalRect(x, y + 12, - rU + ((state & 2) == 0 ? 64 : 0), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 24, y + 12, - rU + ((state & 4) == 0 ? 88 : 24), - Vs + 12, 10, 10); - drawTexturedModalRect(x + 12, y + 24, - rU + ((state & 8) == 0 ? 76 : 12), - Vs + 24, 10, 10); + drawTexturedModalRect(x + 12, y, rU + ((state & 1) == 0 ? 76 : 12), Vs, 10, 10); + drawTexturedModalRect(x, y + 12, rU + ((state & 2) == 0 ? 64 : 0), Vs + 12, 10, 10); + drawTexturedModalRect(x + 24, y + 12, rU + ((state & 4) == 0 ? 88 : 24), Vs + 12, 10, 10); + drawTexturedModalRect(x + 12, y + 24, rU + ((state & 8) == 0 ? 76 : 12), Vs + 24, 10, 10); break; case 4://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 4) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 8) == 0 ? 88 : 24), - Vs + 24, 10, 10); + drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); + drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); + drawTexturedModalRect(x, y + 24, rU + ((state & 4) == 0 ? 64 : 0), Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, rU + ((state & 8) == 0 ? 88 : 24), Vs + 24, 10, 10); break; case 5://xox ooo xox - drawTexturedModalRect(x, y, - rU + ((state & 1) == 0 ? 64 : 0), - Vs, 10, 10); - drawTexturedModalRect(x + 24, y, - rU + ((state & 2) == 0 ? 88 : 24), - Vs, 10, 10); - drawTexturedModalRect(x + 12, y + 12, - rU + ((state & 4) == 0 ? 76 : 12), - Vs + 12, 10, 10); - drawTexturedModalRect(x, y + 24, - rU + ((state & 8) == 0 ? 64 : 0), - Vs + 24, 10, 10); - drawTexturedModalRect(x + 24, y + 24, - rU + ((state & 16) == 0 ? 88 : 24), - Vs + 24, 10, 10); + drawTexturedModalRect(x, y, rU + ((state & 1) == 0 ? 64 : 0), Vs, 10, 10); + drawTexturedModalRect(x + 24, y, rU + ((state & 2) == 0 ? 88 : 24), Vs, 10, 10); + drawTexturedModalRect(x + 12, y + 12, rU + ((state & 4) == 0 ? 76 : 12), Vs + 12, 10, 10); + drawTexturedModalRect(x, y + 24, rU + ((state & 8) == 0 ? 64 : 0), Vs + 24, 10, 10); + drawTexturedModalRect(x + 24, y + 24, rU + ((state & 16) == 0 ? 88 : 24), Vs + 24, 10, 10); break; } x -= 6; @@ -100,17 +69,15 @@ public class GT_GUIContainer_UncertaintyAdv extends GT_GUIContainerMetaTile_Mach glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); for (int i = 0; i < 16; i++) { - GL11.glColor4f(1f, 1f, 1f, (float) ((GT_Container_Uncertainty) this.mContainer).matrix[i] / 1000f); - drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), - fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); + glColor4f(1f, 1f, 1f, (float) ((GT_Container_Uncertainty) mContainer).matrix[i] / 1000f); + drawTexturedModalRect(x + 12 * (i / 4), y + 12 * (i % 4), fU + 12 * (i / 4), V + 12 * (i % 4), 10, 10); } glDisable(GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - if (((GT_Container_Uncertainty) this.mContainer).selection > -1) { - int sel = ((GT_Container_Uncertainty) this.mContainer).selection; - drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), - bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); + glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + if (((GT_Container_Uncertainty) mContainer).selection > -1) { + int sel = ((GT_Container_Uncertainty) mContainer).selection; + drawTexturedModalRect(x + 12 * (sel / 4), y + 12 * (sel % 4), bU + 12 * (sel / 4), V + 12 * (sel % 4), 10, 10); } } } 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 f64e6c84d5..cfcbf1ac90 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 @@ -63,8 +63,9 @@ public class GT_MetaTileEntity_EM_annihilation extends GT_MetaTileEntity_Multibl super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_annihilation(this.mName); + return new GT_MetaTileEntity_EM_annihilation(mName); } @Override 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 a4eb61ae65..0bd68e88b0 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 @@ -132,8 +132,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(this.mName); + return new GT_MetaTileEntity_EM_bhg(mName); } @Override 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 2903b99759..6d552c7263 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 @@ -60,12 +60,12 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB {"F2222#\"#2222","F41155555114","F2222#\"#2222",}, }; private static final Block[] blockType = new Block[]{ - TT_Container_Casings.sBlockCasingsTT, - TT_Container_Casings.sBlockCasingsTT, - TT_Container_Casings.sBlockCasingsTT, + sBlockCasingsTT, + sBlockCasingsTT, + sBlockCasingsTT, QuantumGlassBlock.INSTANCE, - TT_Container_Casings.sBlockCasingsTT, - TT_Container_Casings.sBlockCasingsTT + sBlockCasingsTT, + sBlockCasingsTT }; private static final byte[] blockMeta1 = new byte[]{4, 7, 4, 0, 4, 8}; private static final byte[] blockMeta2 = new byte[]{4, 7, 5, 0, 6, 9}; @@ -91,8 +91,9 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_collider(this.mName); + return new GT_MetaTileEntity_EM_collider(mName); } @Override @@ -132,7 +133,7 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { int xDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetX*2; int zDir = ForgeDirection.getOrientation(iGregTechTileEntity.getBackFacing()).offsetZ*2; - if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != TT_Container_Casings.sBlockCasingsTT) { + if (iGregTechTileEntity.getBlockOffset(xDir, 0, zDir) != sBlockCasingsTT) { eTier = 0; return false; } @@ -149,10 +150,10 @@ public class GT_MetaTileEntity_EM_collider extends GT_MetaTileEntity_MultiblockB boolean test; switch (eTier) { case 1: - test = structureCheck_EM(shape, blockType, blockMeta1,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback, 11, 1, 18); + test = structureCheck_EM(shape, blockType, blockMeta1, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); break; case 2: - test = structureCheck_EM(shape, blockType, blockMeta2,addingMethods,casingTextures,blockTypeFallback,blockMetaFallback, 11, 1, 18); + test = structureCheck_EM(shape, blockType, blockMeta2, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, 11, 1, 18); break; default: eTier = 0; 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 c921a2abbe..c1460a9886 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 @@ -18,6 +18,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -73,8 +74,9 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB eCertainStatus = -128;//no-brain value } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_computer(this.mName); + return new GT_MetaTileEntity_EM_computer(mName); } @Override @@ -114,7 +116,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB int rackComputation; for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) { - if (!isValidMetaTileEntity(rack)) continue; + if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) continue; if (rack.heat > maxCurrentTemp) maxCurrentTemp = rack.heat; rackComputation = rack.tickComponents((float) overClockRatio, (float) overVoltageRatio); if (rackComputation > 0) { @@ -149,7 +151,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void outputAfterRecipe_EM() { if (eOutputData.size() > 0) { - final Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(pos, eAvailableData); for (GT_MetaTileEntity_Hatch_InputData i : eInputData) { if (i.q == null || i.q.contains(pos)) continue; @@ -184,33 +186,33 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { double ocRatio = getParameterIn(0, 0); - if (ocRatio < 0) setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - else if (ocRatio < 1) setStatusOfParameterIn(0, 0, STATUS_LOW); - else if (ocRatio == 1) setStatusOfParameterIn(0, 0, STATUS_OK); - else if (ocRatio <= 3) setStatusOfParameterIn(0, 0, STATUS_HIGH); - else if (Double.isNaN(ocRatio)) setStatusOfParameterIn(0, 0, STATUS_WRONG); - else setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); + if (ocRatio < 0) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (ocRatio < 1) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (ocRatio == 1) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else if (ocRatio <= 3) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_HIGH); + else if (Double.isNaN(ocRatio)) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); double ovRatio = getParameterIn(0, 1); - if (ovRatio < 0.7f) setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); - else if (ovRatio < 0.8f) setStatusOfParameterIn(0, 1, STATUS_LOW); - else if (ovRatio <= 1.2f) setStatusOfParameterIn(0, 1, STATUS_OK); - else if (ovRatio <= 2) setStatusOfParameterIn(0, 1, STATUS_HIGH); - else if (Double.isNaN(ovRatio)) setStatusOfParameterIn(0, 1, STATUS_WRONG); - else setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); + if (ovRatio < 0.7f) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (ovRatio < 0.8f) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (ovRatio <= 1.2f) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else if (ovRatio <= 2) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_HIGH); + else if (Double.isNaN(ovRatio)) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); setParameterOut(0, 0, maxCurrentTemp); setParameterOut(0, 1, eAvailableData); - if (maxCurrentTemp < -10000) setStatusOfParameterOut(0, 0, STATUS_TOO_LOW); - else if (maxCurrentTemp < 0) setStatusOfParameterOut(0, 0, STATUS_LOW); - else if (maxCurrentTemp == 0) setStatusOfParameterOut(0, 0, STATUS_OK); - else if (maxCurrentTemp <= 5000) setStatusOfParameterOut(0, 0, STATUS_HIGH); - else setStatusOfParameterOut(0, 0, STATUS_TOO_HIGH); + if (maxCurrentTemp < -10000) setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (maxCurrentTemp < 0) setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (maxCurrentTemp == 0) setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else if (maxCurrentTemp <= 5000) setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_HIGH); + else setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); - if (!machineBusy) setStatusOfParameterOut(0, 1, STATUS_UNUSED); - else if (eAvailableData <= 0) setStatusOfParameterOut(0, 1, STATUS_TOO_LOW); - else setStatusOfParameterOut(0, 1, STATUS_OK); + if (!machineBusy) setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); + else if (eAvailableData <= 0) setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else setStatusOfParameterOut(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); } @@ -232,7 +234,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) - if (isValidMetaTileEntity(rack)) + 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)) @@ -253,7 +255,7 @@ public class GT_MetaTileEntity_EM_computer extends GT_MetaTileEntity_MultiblockB return false; eCertainMode = (byte) Math.min(totalLen / 3, 5); for (GT_MetaTileEntity_Hatch_Rack rack : eRacks) - if (isValidMetaTileEntity(rack)) + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); return eUncertainHatches.size() == 1; } 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 b2942f8c1c..4c382c178a 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 @@ -28,7 +28,7 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB private static Textures.BlockIcons.CustomIcon ScreenOFF; private static Textures.BlockIcons.CustomIcon ScreenON; - public final static String crafter="EM Crafting"; + public static final String crafter="EM Crafting"; //region structure private static final String[][] shape = new String[][]{ {"A000","0 0","0 . 0","0 0","A000",}, @@ -64,8 +64,9 @@ public class GT_MetaTileEntity_EM_crafting extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_crafting(this.mName); + return new GT_MetaTileEntity_EM_crafting(mName); } @Override 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 1471940085..d884f347e7 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 @@ -13,6 +13,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -66,8 +67,9 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_decay(this.mName); + return new GT_MetaTileEntity_EM_decay(mName); } @Override @@ -139,13 +141,13 @@ public class GT_MetaTileEntity_EM_decay extends GT_MetaTileEntity_MultiblockBase long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } 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 eb1ed256e4..0a3d5eb913 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 @@ -63,8 +63,9 @@ public class GT_MetaTileEntity_EM_dequantizer extends GT_MetaTileEntity_Multiblo super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_dequantizer(this.mName); + return new GT_MetaTileEntity_EM_dequantizer(mName); } @Override 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 a440ece804..cd6cde613f 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 @@ -62,8 +62,9 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa return aFacing >= 2; } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_infuser(this.mName); + return new GT_MetaTileEntity_EM_infuser(mName); } @Override @@ -73,7 +74,7 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png",true,false,true); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true,false,true); } @Override @@ -114,16 +115,14 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa if (itemStack != null && itemStack.stackSize == 1) { Item ofThis = itemStack.getItem(); if (ofThis instanceof IElectricItem) { - if (doChargeItemStack((IElectricItem) ofThis, itemStack) == 0) - this.getBaseMetaTileEntity().disableWorking(); + if (doChargeItemStack((IElectricItem) ofThis, itemStack) == 0) getBaseMetaTileEntity().disableWorking(); return; } else if (TecTech.hasCOFH && ofThis instanceof IEnergyContainerItem) { - if (doChargeItemStackRF((IEnergyContainerItem) ofThis, itemStack) == 0) - this.getBaseMetaTileEntity().disableWorking(); + if (doChargeItemStackRF((IEnergyContainerItem) ofThis, itemStack) == 0) getBaseMetaTileEntity().disableWorking(); return; } } - this.getBaseMetaTileEntity().disableWorking(); + getBaseMetaTileEntity().disableWorking(); } @Override @@ -140,13 +139,13 @@ 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) this.setEUVar(this.getEUVar() - (this.getEUVar() >> 5)); + if (euDiff > 0) setEUVar(getEUVar() - (getEUVar() >> 5)); long remove = (long) Math.ceil( ElectricItem.manager.charge(stack, - Math.min(euDiff, this.getEUVar()) + Math.min(euDiff, getEUVar()) , item.getTier(stack), true, false)); - this.setEUVar(this.getEUVar() - remove); - if (this.getEUVar() < 0) this.setEUVar(0); + setEUVar(getEUVar() - remove); + if (getEUVar() < 0) setEUVar(0); return remove; } catch (Exception e) { if (DEBUG_MODE) e.printStackTrace(); @@ -156,12 +155,12 @@ public class GT_MetaTileEntity_EM_infuser extends GT_MetaTileEntity_MultiblockBa private long doChargeItemStackRF(IEnergyContainerItem item, ItemStack stack) { try { - long RF = Math.min(item.getMaxEnergyStored(stack) - item.getEnergyStored(stack), this.getEUVar() * mEUtoRF / 100L); + 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; - this.setEUVar(this.getEUVar() - RF); - if (this.getEUVar() < 0) this.setEUVar(0); + setEUVar(getEUVar() - RF); + if (getEUVar() < 0) setEUVar(0); return RF; } catch (Exception e) { if (DEBUG_MODE) e.printStackTrace(); 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 9e16f179e3..1e17491b75 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 @@ -49,8 +49,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_junction(this.mName); + return new GT_MetaTileEntity_EM_junction(mName); } @Override @@ -83,22 +84,22 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB for (int i = 0; i < 10; i++) { src = getParameterIn(i, 0); if (src <= 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, STATUS_UNUSED); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); } else if (src > eInputHatches.size()) { - setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); - setStatusOfParameterIn(i, 1, STATUS_UNUSED); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); } else if (Double.isNaN(src)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - setStatusOfParameterIn(i, 1, STATUS_UNUSED); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); } else { - setStatusOfParameterIn(i, 0, STATUS_OK); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); dest = getParameterIn(i, 1); - if (dest < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - else if (dest == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); - else if (dest > eOutputHatches.size()) setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, STATUS_WRONG); - else setStatusOfParameterIn(i, 1, STATUS_OK); + if (dest < 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (dest == 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (dest > eOutputHatches.size()) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); + else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); } } } @@ -108,7 +109,7 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB for (GT_MetaTileEntity_Hatch_InputElemental in : eInputHatches) if (in.getContainerHandler().hasStacks()) { mEUt = -(int) V[8]; - eAmpereFlow = 1 + ((eInputHatches.size() + eOutputHatches.size()) >> 1); + eAmpereFlow = 1 + (eInputHatches.size() + eOutputHatches.size() >> 1); mMaxProgresstime = 20; mEfficiencyIncrease = 10000; return true; @@ -123,9 +124,9 @@ public class GT_MetaTileEntity_EM_junction extends GT_MetaTileEntity_MultiblockB src= getParameterIn(i,0); dest= getParameterIn(i,1); if(Double.isNaN(src) || Double.isNaN(dest)) continue; - final int inIndex = (int)src - 1; + int inIndex = (int)src - 1; if (inIndex < 0 || inIndex >= eInputHatches.size()) continue; - final int outIndex = (int)dest - 1; + int outIndex = (int)dest - 1; GT_MetaTileEntity_Hatch_InputElemental in = eInputHatches.get(inIndex); if (outIndex == -1) {//param==0 -> null the content cleanHatchContentEM_EM(in); 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 e2b485c2ba..06d8f58183 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 @@ -63,8 +63,9 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_quantizer(this.mName); + return new GT_MetaTileEntity_EM_quantizer(mName); } @Override @@ -111,8 +112,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock aOredictQuantizationInfo aOQI = bTransformationInfo.oredictQuantization.get(ID); if (aOQI == null) continue; iHasElementalDefinition into = aOQI.output(); - if (into != null && isInputEqual(true, false, - nothingF, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { + if (into != null && isInputEqual(true, false, GT_MetaTileEntity_MultiblockBase_EM.nothingF, new ItemStack[]{new ItemStack(is.getItem(), aOQI.amount, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; } @@ -122,8 +122,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (DEBUG_MODE) TecTech.Logger.info("Quantifier-Item-recipe " + is.getItem().getUnlocalizedName() + "." + is.getItemDamage()); iHasElementalDefinition into = aIQI.output(); - if (into != null && isInputEqual(true, false, - nothingF, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { + if (into != null && isInputEqual(true, false, GT_MetaTileEntity_MultiblockBase_EM.nothingF, new ItemStack[]{new ItemStack(is.getItem(), aIQI.input().stackSize, is.getItemDamage())}, null, inI)) { startRecipe(into); return true; } @@ -137,7 +136,7 @@ public class GT_MetaTileEntity_EM_quantizer extends GT_MetaTileEntity_Multiblock if (aFQI == null) continue; iHasElementalDefinition into = aFQI.output(); if (into != null && fs.amount >= aFQI.input().amount && isInputEqual(true, false, - new FluidStack[]{aFQI.input()}, nothingI, inF, (ItemStack[]) null)) { + new FluidStack[]{aFQI.input()}, GT_MetaTileEntity_MultiblockBase_EM.nothingI, inF, (ItemStack[]) null)) { startRecipe(into); return true; } 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 bc0db49be4..d84c791404 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 @@ -16,6 +16,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; @@ -81,14 +82,15 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_research(this.mName); + return new GT_MetaTileEntity_EM_research(mName); } @Override public boolean checkMachine_EM(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) - if (isValidMetaTileEntity(rack)) + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) rack.getBaseMetaTileEntity().setActive(false); eHolders.clear(); @@ -96,7 +98,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB return false; for (GT_MetaTileEntity_Hatch_Holder rack : eHolders) - if (isValidMetaTileEntity(rack)) + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(rack)) rack.getBaseMetaTileEntity().setActive(iGregTechTileEntity.isActive()); return eHolders.size() == 1; } @@ -148,7 +150,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } 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)) { - this.aRecipe = assRecipeTT; + aRecipe = assRecipeTT; machineType = machine; break; } @@ -156,7 +158,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB if (aRecipe == null) { for (TT_recipe.TT_assLineRecipe assRecipeTT : TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()) { if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - this.aRecipe = assRecipeTT; + aRecipe = assRecipeTT; machineType = crafter; break; } @@ -185,7 +187,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB 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)) { - this.tRecipe = assRecipe; + tRecipe = assRecipe; //if found for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { if (GT_Utility.areStacksEqual(ttRecipe.mInputs[0], holdItem, true)) { @@ -204,7 +206,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB }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)) { - this.aRecipe = assRecipeTT; + aRecipe = assRecipeTT; machineType=machine; //if found for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { @@ -223,7 +225,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } for (TT_recipe.TT_assLineRecipe assRecipeTT:TT_recipe.TT_Recipe_Map.sCrafterRecipes.recipeList()){ if (GT_Utility.areStacksEqual(assRecipeTT.mResearchItem, holdItem, true)) { - this.aRecipe = assRecipeTT; + aRecipe = assRecipeTT; machineType=crafter; //if found for (GT_Recipe ttRecipe : TT_recipe.GT_Recipe_MapTT.sResearchableFakeRecipes.mRecipeList) { @@ -283,7 +285,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB } tNBT.setString("author", EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE + "Tech" + EnumChatFormatting.WHITE + " Assembling Line Recipe Generator"); NBTTagList tNBTList = new NBTTagList(); - tNBTList.appendTag(new NBTTagString("Construction plan for " + tRecipe.mOutput.stackSize + " " + GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + ". Needed EU/t: " + tRecipe.mEUt + " Production time: " + (tRecipe.mDuration / 20))); + tNBTList.appendTag(new NBTTagString("Construction plan for " + tRecipe.mOutput.stackSize + " " + GT_LanguageManager.getTranslation(tRecipe.mOutput.getDisplayName()) + ". Needed EU/t: " + tRecipe.mEUt + " Production time: " + tRecipe.mDuration / 20)); for (int i = 0; i < tRecipe.mInputs.length; i++) { if (tRecipe.mInputs[i] != null) { tNBTList.appendTag(new NBTTagString("Input Bus " + (i + 1) + ": " + tRecipe.mInputs[i].stackSize + " " + GT_LanguageManager.getTranslation(tRecipe.mInputs[i].getDisplayName()))); @@ -327,7 +329,7 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB @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 GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3], new GT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][3]}; } @@ -390,13 +392,13 @@ public class GT_MetaTileEntity_EM_research extends GT_MetaTileEntity_MultiblockB long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } 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 f54fd46555..06b4cf6f31 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 @@ -2,7 +2,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi; import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; import com.github.technus.tectech.elementalMatter.core.stacks.cElementalInstanceStack; @@ -19,6 +18,7 @@ import gregtech.api.enums.ItemList; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe; import net.minecraft.block.Block; @@ -94,8 +94,9 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa eDismantleBoom=true; } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_scanner(this.mName); + return new GT_MetaTileEntity_EM_scanner(mName); } @Override @@ -280,56 +281,56 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa } private void addComputationRequirements(int depthPlus, int capabilities){ - if(Util.areBitsSet(SCAN_GET_NOMENCLATURE,capabilities)){ + if(areBitsSet(SCAN_GET_NOMENCLATURE,capabilities)){ totalComputationRequired +=depthPlus*5; eRequiredData+=depthPlus; } - if(Util.areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)){ + if(areBitsSet(SCAN_GET_DEPTH_LEVEL,capabilities)){ totalComputationRequired +=depthPlus*10; eRequiredData+=depthPlus; } - if(Util.areBitsSet(SCAN_GET_AMOUNT,capabilities)){ + if(areBitsSet(SCAN_GET_AMOUNT,capabilities)){ totalComputationRequired +=depthPlus*64; eRequiredData+=depthPlus*8; } - if(Util.areBitsSet(SCAN_GET_CHARGE,capabilities)){ + if(areBitsSet(SCAN_GET_CHARGE,capabilities)){ totalComputationRequired +=depthPlus*128; eRequiredData+=depthPlus*4; } - if(Util.areBitsSet(SCAN_GET_MASS,capabilities)){ + if(areBitsSet(SCAN_GET_MASS,capabilities)){ totalComputationRequired +=depthPlus*256; eRequiredData+=depthPlus*4; } - if(Util.areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)){ + if(areBitsSet(SCAN_GET_ENERGY_LEVEL,capabilities)){ totalComputationRequired +=depthPlus*512; eRequiredData+=depthPlus*16; } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)){ + if(areBitsSet(SCAN_GET_TIMESPAN_INFO,capabilities)){ totalComputationRequired +=depthPlus*1024; eRequiredData+=depthPlus*32; } - if(Util.areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){ + if(areBitsSet(SCAN_GET_ENERGY_STATES,capabilities)){ totalComputationRequired +=depthPlus*2048; eRequiredData+=depthPlus*32; } - if(Util.areBitsSet(SCAN_GET_COLOR,capabilities)){ + if(areBitsSet(SCAN_GET_COLOR,capabilities)){ totalComputationRequired +=depthPlus*1024; eRequiredData+=depthPlus*48; } - if(Util.areBitsSet(SCAN_GET_AGE,capabilities)){ + if(areBitsSet(SCAN_GET_AGE,capabilities)){ totalComputationRequired +=depthPlus*2048; eRequiredData+=depthPlus*64; } - if(Util.areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)){ + if(areBitsSet(SCAN_GET_TIMESPAN_MULT,capabilities)){ totalComputationRequired +=depthPlus*2048; eRequiredData+=depthPlus*64; @@ -377,13 +378,13 @@ public class GT_MetaTileEntity_EM_scanner extends GT_MetaTileEntity_MultiblockBa long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } 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 c75453dc26..c259a8b7fa 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 @@ -47,8 +47,9 @@ public class GT_MetaTileEntity_EM_stabilizer extends GT_MetaTileEntity_Multibloc super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_stabilizer(this.mName); + return new GT_MetaTileEntity_EM_stabilizer(mName); } @Override 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 af304aee65..7b2dbd35c7 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 @@ -52,14 +52,15 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_switch(this.mName); + 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 GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1], new GT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][1]}; } @@ -110,7 +111,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas total += weight;//Total weighted div } - final Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); QuantumDataPacket pack = new QuantumDataPacket(pos, 0); for (GT_MetaTileEntity_Hatch_InputData i : eInputData) { if (i.q == null || i.q.contains(pos)) continue; @@ -124,7 +125,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas dest= getParameterIn(i,1); weight= getParameterIn(i,0); if (weight > 0 && dest >= 0) { - final int outIndex = (int)dest - 1; + int outIndex = (int)dest - 1; if (outIndex < 0 || outIndex >= eOutputData.size()) continue; GT_MetaTileEntity_Hatch_OutputData out = eOutputData.get(outIndex); if(Double.isInfinite(total)){ @@ -133,7 +134,7 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas break; } }else{ - final long part = (long) Math.floor((pack.computation * weight) / total); + long part = (long) Math.floor(pack.computation * weight / total); if (part > 0) { remaining -= part; if (remaining > 0) out.q = new QuantumDataPacket(pack, part); @@ -154,19 +155,19 @@ public class GT_MetaTileEntity_EM_switch extends GT_MetaTileEntity_MultiblockBas for (int i = 0; i < 10; i++) { weight = getParameterIn(i, 0); if (weight <= 0) { - setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - setStatusOfParameterIn(i, 1, STATUS_UNUSED); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); } else if (Double.isNaN(weight)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); - setStatusOfParameterIn(i, 1, STATUS_UNUSED); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_UNUSED); } else { - setStatusOfParameterIn(i, 0, STATUS_OK); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); dest = getParameterIn(i, 1); - if (dest < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - else if (dest == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); - else if (dest > eOutputData.size()) setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); - else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, STATUS_WRONG); - else setStatusOfParameterIn(i, 1, STATUS_OK); + if (dest < 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (dest == 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (dest > eOutputData.size()) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); + else if (Double.isNaN(dest)) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); } } } 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 f547b444ac..a713e173b1 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 @@ -65,8 +65,9 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo eDismantleBoom=true; } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_transformer(this.mName); + return new GT_MetaTileEntity_EM_transformer(mName); } @Override @@ -86,7 +87,7 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png",true,false,false); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png",true,false,false); } @Override @@ -94,9 +95,10 @@ public class GT_MetaTileEntity_EM_transformer extends GT_MetaTileEntity_Multiblo 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 GT_RenderedTexture(aActive ? ScreenON : ScreenOFF)}; + return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0], new GT_RenderedTexture(aActive ? GT_MetaTileEntity_MultiblockBase_EM.ScreenON : GT_MetaTileEntity_MultiblockBase_EM.ScreenOFF)}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[texturePage][0]}; } 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 c410bb289c..5fb232b256 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 @@ -64,8 +64,9 @@ public class GT_MetaTileEntity_EM_wormhole extends GT_MetaTileEntity_MultiblockB super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_wormhole(this.mName); + return new GT_MetaTileEntity_EM_wormhole(mName); } @Override 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 e634bde66c..6ef8f8adc8 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 @@ -35,7 +35,7 @@ import static gregtech.api.GregTech_API.sBlockCasings4; * Created by danie_000 on 17.12.2016. */ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - public final static int POWER_SETTING_DEFAULT=1000, TIMER_SETTING_DEFAULT=360; + public static final int POWER_SETTING_DEFAULT=1000, TIMER_SETTING_DEFAULT=360; private int powerSetting,timerSetting,timerValue; private boolean hasBeenPausedThisCycle=false; private boolean flipped=false; @@ -78,8 +78,9 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_TM_microwave(this.mName); + return new GT_MetaTileEntity_TM_microwave(mName); } @Override @@ -99,7 +100,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png", false, false, true);//todo texture + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png", false, false, true);//todo texture } @Override @@ -238,7 +239,7 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock protected void parametersLoadDefault_EM() { powerSetting = POWER_SETTING_DEFAULT; timerSetting = TIMER_SETTING_DEFAULT; - setParameterPairIn_ClearOut(0,false,POWER_SETTING_DEFAULT,TIMER_SETTING_DEFAULT); + setParameterPairIn_ClearOut(0,false, POWER_SETTING_DEFAULT, TIMER_SETTING_DEFAULT); } @Override @@ -250,18 +251,18 @@ public class GT_MetaTileEntity_TM_microwave extends GT_MetaTileEntity_Multiblock @Override public void parametersOutAndStatusesWrite_EM(boolean machineBusy) { double powerParameter = getParameterIn(0, 0); - if (powerParameter < 300) setStatusOfParameterIn(0, 0, STATUS_TOO_LOW); - else if (powerParameter < 1000) setStatusOfParameterIn(0, 0, STATUS_LOW); - else if (powerParameter == 1000) setStatusOfParameterIn(0, 0, STATUS_OK); - else if (powerParameter == Double.POSITIVE_INFINITY) setStatusOfParameterIn(0, 0, STATUS_TOO_HIGH); - else if (Double.isNaN(powerParameter)) setStatusOfParameterIn(0, 0, STATUS_WRONG); - else setStatusOfParameterOut(0, 0, STATUS_HIGH); + if (powerParameter < 300) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (powerParameter < 1000) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (powerParameter == 1000) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else if (powerParameter == Double.POSITIVE_INFINITY) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); + else if (Double.isNaN(powerParameter)) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterOut(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_HIGH); double timerParameter = getParameterIn(0, 1); - if (timerParameter <= 1) setStatusOfParameterIn(0, 1, STATUS_TOO_LOW); - else if (timerParameter <= 3000) setStatusOfParameterIn(0, 0, STATUS_OK); - else if (Double.isNaN(timerParameter)) setStatusOfParameterIn(0, 1, STATUS_WRONG); - else setStatusOfParameterIn(0, 1, STATUS_TOO_HIGH); + if (timerParameter <= 1) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (timerParameter <= 3000) setStatusOfParameterIn(0, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else if (Double.isNaN(timerParameter)) setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else setStatusOfParameterIn(0, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); setParameterOut(0, 0, timerValue); setParameterOut(0, 1, timerSetting - timerValue); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java index 3c86d4a0da..cc031e6772 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_Container_MultiMachineEM.java @@ -36,18 +36,18 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { @Override public void addSlots(InventoryPlayer aInventoryPlayer) { addSlotToContainer(new Slot(mTileEntity, 1, 152, -21)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, -2, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 15, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 32, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, -2, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 15, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 32, false, false, 1)); } @Override public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { if (aSlotIndex < 0) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { - GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity(); + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { + GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity(); switch (aSlotIndex) { case 1: if(ePowerPassButton) { @@ -78,22 +78,22 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null) || (this.eParamsInStatus == null)) + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null || eParamsInStatus == null) return; - this.eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsInStatus; - this.eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eParamsOutStatus; - this.eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainMode; - this.eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eCertainStatus; - this.ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).ePowerPass; - this.eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) this.mTileEntity.getMetaTileEntity()).eSafeVoid; - this.allowedToWork = this.mTileEntity.isAllowedToWork(); + eParamsInStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eParamsInStatus; + eParamsOutStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eParamsOutStatus; + eCertainMode = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainMode; + eCertainStatus = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eCertainStatus; + ePowerPass = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).ePowerPass; + eSafeVoid = ((GT_MetaTileEntity_MultiblockBase_EM) mTileEntity.getMetaTileEntity()).eSafeVoid; + allowedToWork = mTileEntity.isAllowedToWork(); - for (Object crafter : this.crafters) { + for (Object crafter : crafters) { ICrafting var1 = (ICrafting) crafter; int i = 100; for (int j = 0; j < eParamsInStatus.length; j++) - var1.sendProgressBarUpdate(this, i++, eParamsInStatus[j] | (eParamsOutStatus[j] << 8)); - var1.sendProgressBarUpdate(this, 120, eCertainMode | (eCertainStatus << 8)); + var1.sendProgressBarUpdate(this, i++, eParamsInStatus[j] | eParamsOutStatus[j] << 8); + var1.sendProgressBarUpdate(this, 120, eCertainMode | eCertainStatus << 8); var1.sendProgressBarUpdate(this, 121, (ePowerPass ? 1 : 0) + (eSafeVoid ? 2 : 0) + (allowedToWork ? 4 : 0)); } } @@ -101,17 +101,17 @@ public class GT_Container_MultiMachineEM extends GT_ContainerMetaTile_Machine { @Override public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); - if (this.eParamsInStatus == null) return; + if (eParamsInStatus == null) return; if (par1 >= 100 && par1 < 120) { - this.eParamsInStatus[par1 - 100] = (byte) (par2 & 0xff); - this.eParamsOutStatus[par1 - 100] = (byte) (par2 >>> 8); + eParamsInStatus[par1 - 100] = (byte) (par2 & 0xff); + eParamsOutStatus[par1 - 100] = (byte) (par2 >>> 8); } else if (par1 == 120) { - this.eCertainMode = (byte) (par2 & 0xff); - this.eCertainStatus = (byte) (par2 >>> 8); + eCertainMode = (byte) (par2 & 0xff); + eCertainStatus = (byte) (par2 >>> 8); } else if (par1 == 121) { - this.ePowerPass = (par2 & 1) == 1; - this.eSafeVoid = (par2 & 2) == 2; - this.allowedToWork = (par2 & 4) == 4; + ePowerPass = (par2 & 1) == 1; + eSafeVoid = (par2 & 2) == 2; + allowedToWork = (par2 & 4) == 4; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java index 94a70f6e50..8c56bbf5e8 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/multi/base/GT_GUIContainer_MultiMachineEM.java @@ -74,7 +74,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach int y = (height - ySize) / 2; y -= 26; drawTexturedModalRect(x, y, 0, 0, xSize, ySize + 26); - if (this.mContainer != null && ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus != null) { + if (mContainer != null && ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus != null) { counter = (byte) ((1 + counter) % 6); GL11.glColor4f(1f, 1f, 1f, 1f); @@ -97,17 +97,17 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach y += 96; for (int i = 0; i < 20; ) { byte j = (byte) (i >>> 1); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j]); - LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) this.mContainer).eParamsInStatus[j + 10]); - LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) this.mContainer).eParamsOutStatus[j + 10]); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[j]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[j]); + LEDdrawP(x, y, i, 0, ((GT_Container_MultiMachineEM) mContainer).eParamsInStatus[j + 10]); + LEDdrawP(x, y, i++, 1, ((GT_Container_MultiMachineEM) mContainer).eParamsOutStatus[j + 10]); } - final short rU = 183, Vs = 77; + short rU = 183, Vs = 77; x += 140; y -= 19; - final byte state = ((GT_Container_MultiMachineEM) this.mContainer).eCertainStatus; - switch (((GT_Container_MultiMachineEM) this.mContainer).eCertainMode) { + byte state = ((GT_Container_MultiMachineEM) mContainer).eCertainStatus; + switch (((GT_Container_MultiMachineEM) mContainer).eCertainMode) { case 1://ooo oxo ooo drawTexturedModalRect(x + 6, y + 6, rU + (state == 0 ? 38 : 6), @@ -171,7 +171,7 @@ public class GT_GUIContainer_MultiMachineEM extends GT_GUIContainerMetaTile_Mach } private void LEDdrawP(int x, int y, int i, int j, byte status) { - final int v = 192, su = 8, sv = 6, u = 11; + int v = 192, su = 8, sv = 6, u = 11; switch (status) { case STATUS_WRONG: if (counter < 2) { 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 b2db48ee35..7a5597281d 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 @@ -1,8 +1,6 @@ package com.github.technus.tectech.thing.metaTileEntity.multi.base; -import com.github.technus.tectech.CommonValues; import com.github.technus.tectech.TecTech; -import com.github.technus.tectech.Util; import com.github.technus.tectech.Vec3pos; import com.github.technus.tectech.elementalMatter.core.cElementalInstanceStackMap; import com.github.technus.tectech.elementalMatter.core.stacks.cElementalDefinitionStack; @@ -45,13 +43,13 @@ import static com.github.technus.tectech.thing.casing.GT_Block_CasingsTT.texture * Created by danie_000 on 27.10.2016. */ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEntity_MultiBlockBase { - protected final static Map<String, Method> adderMethodMap = new HashMap<>(); + protected static final Map<String, Method> adderMethodMap = new HashMap<>(); private static Method adderMethod; protected cElementalInstanceStackMap[] outputEM; - public final static ItemStack[] nothingI = new ItemStack[0]; - public final static FluidStack[] nothingF = new FluidStack[0]; + public static final ItemStack[] nothingI = new ItemStack[0]; + public static final FluidStack[] nothingF = new FluidStack[0]; protected static Textures.BlockIcons.CustomIcon ScreenOFF; protected static Textures.BlockIcons.CustomIcon ScreenON; @@ -75,7 +73,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt final byte[] eParamsInStatus = new byte[20];//LED status for I final byte[] eParamsOutStatus = new byte[20];//LED status for O - public final static byte STATUS_UNUSED = 0, + public static final byte STATUS_UNUSED = 0, STATUS_TOO_LOW = 1, STATUS_LOW = 2, STATUS_WRONG = 3, STATUS_OK = 4, STATUS_TOO_HIGH = 5, STATUS_HIGH = 6; @@ -140,7 +138,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt //Get Available data, Override only on data producers should return mAvailableData that is set in check recipe protected long getAvailableData_EM() { long result = 0; - final Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); + Vec3pos pos = new Vec3pos(getBaseMetaTileEntity()); for (GT_MetaTileEntity_Hatch_InputData in : eInputData) if (in.q != null) result += in.q.computationIfNotContained(pos); return result; @@ -234,14 +232,14 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, + TEC_MARK_GENERAL, "Nothing special just override me." }; } //RATHER LEAVE ALONE Section protected boolean areChunksAroundLoaded_EM(){ - if(isValidMetaTileEntity(this) && getBaseMetaTileEntity().isServerSide()){ + 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 @@ -265,7 +263,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "EMDisplay.png"); + return new GT_GUIContainer_MultiMachineEM(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "EMDisplay.png"); } @Override @@ -401,7 +399,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i); } - final int outputLen = aNBT.getInteger("eOutputStackCount"); + int outputLen = aNBT.getInteger("eOutputStackCount"); if (outputLen > 0) { outputEM = new cElementalInstanceStackMap[outputLen]; NBTTagCompound compound=aNBT.getCompoundTag("outputEM"); @@ -544,8 +542,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt Block[] blockTypeFallback,//use numbers 0-9 for casing types byte[] blockMetaFallback,//use numbers 0-9 for casing types int horizontalOffset, int verticalOffset, int depthOffset) { - return StructureCheckerAdvanced(structure, blockType, blockMeta, - adderMethod, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, + return StructureCheckerAdvanced(structure, blockType, blockMeta, adderMethod, addingMethods, casingTextures, blockTypeFallback, blockMetaFallback, horizontalOffset, verticalOffset, depthOffset, getBaseMetaTileEntity(), !mMachine); } @@ -567,19 +564,19 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mMaintenanceHatches.clear(); for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) - if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) - if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = -1; for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) - if (isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) - if (isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) hatch_data.id = -1; for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(false); eUncertainHatches.clear(); eEnergyMulti.clear(); @@ -591,12 +588,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt eOutputData.clear(); eInputData.clear(); - if ((getBaseMetaTileEntity() instanceof BaseTileEntity)) + if (getBaseMetaTileEntity() instanceof BaseTileEntity) ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = mMachine; mMachine = checkMachine(aBaseMetaTileEntity, mInventory[1]); if (!mMachine) { - if ((ePowerPass && getEUVar() > V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) + if (ePowerPass && getEUVar() > V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap tree : outputEM) @@ -608,50 +605,50 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt if (mMachine) { short id = 1; for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eOutputHatches) - if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; id = 1; for (GT_MetaTileEntity_Hatch_ElementalContainer hatch_elemental : eInputHatches) - if (isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_elemental)) hatch_elemental.id = id++; id = 1; for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eOutputData) - if (isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; id = 1; for (GT_MetaTileEntity_Hatch_DataConnector hatch_data : eInputData) - if (isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch_data)) hatch_data.id = id++; if (mEnergyHatches.size() > 0 || eEnergyMulti.size() > 0) { maxEUinputMin = V[15]; maxEUinputMax = V[0]; for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) - if (isValidMetaTileEntity(hatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { if (hatch.maxEUInput() < maxEUinputMin) maxEUinputMin = hatch.maxEUInput(); if (hatch.maxEUInput() > maxEUinputMax) maxEUinputMax = hatch.maxEUInput(); } for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) - if (isValidMetaTileEntity(hatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { if (hatch.maxEUInput() < maxEUinputMin) maxEUinputMin = hatch.maxEUInput(); if (hatch.maxEUInput() > maxEUinputMax) maxEUinputMax = hatch.maxEUInput(); } eMaxAmpereFlow = 0; //counts only full amps for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) - if (isValidMetaTileEntity(hatch)) eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin; for (GT_MetaTileEntity_Hatch_EnergyMulti hatch : eEnergyMulti) - if (isValidMetaTileEntity(hatch)) - eMaxAmpereFlow += (hatch.maxEUInput() / maxEUinputMin) * hatch.Amperes; - if (this.getEUVar() > maxEUStore()) this.setEUVar(this.maxEUStore()); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) + eMaxAmpereFlow += hatch.maxEUInput() / maxEUinputMin * hatch.Amperes; + if (getEUVar() > maxEUStore()) setEUVar(maxEUStore()); } else { maxEUinputMin = 0; maxEUinputMax = 0; eMaxAmpereFlow = 0; - this.setEUVar(0); + setEUVar(0); } for (GT_MetaTileEntity_Hatch_Uncertainty hatch : eUncertainHatches) - if (isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(true); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) hatch.getBaseMetaTileEntity().setActive(true); for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches){ - if (isValidMetaTileEntity(hatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch)) { hatch.getBaseMetaTileEntity().setActive(true); if(hatch.param>=0) bParamsAreFloats[hatch.param]=hatch.isUsingFloats(); } @@ -660,20 +657,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt maxEUinputMin = 0; maxEUinputMax = 0; eMaxAmpereFlow = 0; - this.setEUVar(0); + setEUVar(0); } hatchInit_EM(mMachine); } if (mStartUpCheck < 0) {//E if (mMachine) {//S - final byte Tick = (byte) (aTick % 20); + byte Tick = (byte) (aTick % 20); if (MULTI_PURGE_1_AT == Tick || MULTI_PURGE_2_AT == Tick) purgeAllOverflowEM_EM(); else if (MULTI_CHECK_AT == Tick) for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) { - if (isValidMetaTileEntity(tHatch)) { - if (disableMaintenance) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.disableMaintenance) { mWrench = true; mScrewdriver = true; mSoftHammer = true; @@ -736,32 +733,32 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt {//DO long euVar; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (this.getEUVar() > this.getMinimumStoredEU()) break; - if (isValidMetaTileEntity(tHatch)) { + if (getEUVar() > getMinimumStoredEU()) break; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUInput(); if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) - this.setEUVar(this.getEUVar() + euVar); + setEUVar(getEUVar() + euVar); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (this.getEUVar() > this.getMinimumStoredEU()) break; - if (isValidMetaTileEntity(tHatch)) { + if (getEUVar() > getMinimumStoredEU()) break; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUInput() * tHatch.Amperes; if (tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(euVar, false)) - this.setEUVar(this.getEUVar() + euVar); + setEUVar(getEUVar() + euVar); } } if (ePowerPass) { for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { euVar = tHatch.maxEUOutput(); - if (tHatch.getBaseMetaTileEntity().getStoredEU() <= (tHatch.maxEUStore() - euVar) && + if (tHatch.getBaseMetaTileEntity().getStoredEU() <= tHatch.maxEUStore() - euVar && aBaseMetaTileEntity.decreaseStoredEnergyUnits(euVar + Math.min(euVar >> 7,1), false)) tHatch.setEUVar(tHatch.getBaseMetaTileEntity().getStoredEU() + euVar); } } for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (isValidMetaTileEntity(tHatch)) { + 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)) @@ -801,7 +798,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt mEfficiencyIncrease = 0; if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); }else { afterRecipeCheckFailed(); mMaxProgresstime=0;//Just to be sure... @@ -815,7 +812,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } else if (RECIPE_AT == Tick || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) { if (aBaseMetaTileEntity.isAllowedToWork()) { if (checkRecipe(mInventory[1])) { - mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - ((getIdealStatus() - getRepairStatus()) * 1000))); + mEfficiency = Math.max(0, Math.min(mEfficiency + mEfficiencyIncrease, getMaxEfficiency(mInventory[1]) - (getIdealStatus() - getRepairStatus()) * 1000)); }else { afterRecipeCheckFailed(); mMaxProgresstime=0;//Just to be sure... @@ -831,7 +828,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } - aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & -512) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64) | ((eCertainStatus == 0) ? 0 : 128) | (eParameters ? 0 : 256)); + aBaseMetaTileEntity.setErrorDisplayID(aBaseMetaTileEntity.getErrorDisplayID() & -512 | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64) | (eCertainStatus == 0 ? 0 : 128) | (eParameters ? 0 : 256)); aBaseMetaTileEntity.setActive(mMaxProgresstime > 0); boolean active = aBaseMetaTileEntity.isActive() && mPollution > 0; for (GT_MetaTileEntity_Hatch_Muffler aMuffler : mMufflerHatches) @@ -848,8 +845,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt protected void addFluidOutputs(FluidStack[] mOutputFluids) { int min=mOutputFluids.length>mOutputHatches.size()?mOutputHatches.size():mOutputFluids.length; for (int i = 0; i < min; ++i) { - if (this.mOutputHatches.get(i) != null && mOutputFluids[i] != null && isValidMetaTileEntity(this.mOutputHatches.get(i))) { - this.mOutputHatches.get(i).fill(mOutputFluids[i], true); + if (mOutputHatches.get(i) != null && mOutputFluids[i] != null && GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(mOutputHatches.get(i))) { + mOutputHatches.get(i).fill(mOutputFluids[i], true); } } } @@ -866,7 +863,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public int getRepairStatus() { - return super.getRepairStatus() + ((eCertainStatus == 0) ? 1 : 0) + (this.eParameters ? 1 : 0); + return super.getRepairStatus() + (eCertainStatus == 0 ? 1 : 0) + (eParameters ? 1 : 0); } @Override @@ -883,9 +880,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private boolean energyFlowOnRunningTick(ItemStack aStack, boolean allowProduction) { long euFlow = mEUt * eAmpereFlow;//quick scope sign if (allowProduction && euFlow > 0) { - this.addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); + addEnergyOutput_EM((long) mEUt * (long) mEfficiency / getMaxEfficiency(aStack), eAmpereFlow); } else if (euFlow < 0) { - if (!this.drainEnergyInput_EM(mEUt,(long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, this.mEfficiency), eAmpereFlow)) { + if (!drainEnergyInput_EM(mEUt,(long) mEUt * getMaxEfficiency(aStack) / Math.max(1000L, mEfficiency), eAmpereFlow)) { stopMachine(); return false; } @@ -909,7 +906,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt @Override public final long maxEUStore() { - return (maxEUinputMin * eMaxAmpereFlow) << 3; + return maxEUinputMin * eMaxAmpereFlow << 3; } @Override @@ -932,13 +929,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final boolean addEnergyOutput(long EU) { if (EU <= 0L) return true; for (GT_MetaTileEntity_Hatch tHatch : eDynamoMulti) - if (isValidMetaTileEntity(tHatch)){ + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)){ if(tHatch.maxEUOutput()<EU) explodeMultiblock(); if(tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) return true; } for (GT_MetaTileEntity_Hatch tHatch : mDynamoHatches) - if (isValidMetaTileEntity(tHatch)){ + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)){ if(tHatch.maxEUOutput()<EU) explodeMultiblock(); if(tHatch.getBaseMetaTileEntity().increaseStoredEnergyUnits(EU, false)) return true; @@ -952,7 +949,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt long euVar = EU * Amperes; long diff; for (GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { if (tHatch.maxEUOutput() < EU) explodeMultiblock(); diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); if (diff > 0) { @@ -967,7 +964,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt } } for (GT_MetaTileEntity_Hatch_DynamoMulti tHatch : eDynamoMulti) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { if (tHatch.maxEUOutput() < EU) explodeMultiblock(); diff = tHatch.maxEUStore() - tHatch.getBaseMetaTileEntity().getStoredEU(); if (diff > 0) { @@ -989,10 +986,10 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final boolean drainEnergyInput(long EU) { if (EU <= 0L) return true; for (GT_MetaTileEntity_Hatch tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; for (GT_MetaTileEntity_Hatch tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch) && tHatch.maxEUInput()>EU && tHatch.getBaseMetaTileEntity().decreaseStoredEnergyUnits(EU, false)) return true; return false; } @@ -1004,7 +1001,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt 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)); @@ -1046,9 +1043,9 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final long getMaxInputVoltage() { long rVoltage = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) rVoltage += tHatch.maxEUInput(); return rVoltage; } @@ -1056,20 +1053,20 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt public final long getMaxInputEnergy(){ long energy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) - if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput(); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput(); for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) - if (isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput() * tHatch.Amperes; + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) energy += tHatch.maxEUInput() * tHatch.Amperes; return energy; } //new Method public final int getMaxEnergyInputTier_EM() { - return Util.getTier(maxEUinputMax); + return getTier(maxEUinputMax); } //new Method public final int getMinEnergyInputTier_EM() { - return Util.getTier(maxEUinputMin); + return getTier(maxEUinputMin); } public final long getMaxAmpereFlowAtMinTierOfEnergyHatches(){ @@ -1111,12 +1108,12 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt private void purgeAllOverflowEM_EM() { float mass = 0; for (GT_MetaTileEntity_Hatch_InputElemental tHatch : eInputHatches) { - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); mass += tHatch.overflowMatter; tHatch.overflowMatter = 0; } for (GT_MetaTileEntity_Hatch_OutputElemental tHatch : eOutputHatches) { - if (isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) tHatch.updateSlots(); mass += tHatch.overflowMatter; tHatch.overflowMatter = 0; } @@ -1181,8 +1178,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt boolean busy=mMaxProgresstime>0; if (busy) {//write from buffer to hatches only for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (!isValidMetaTileEntity(hatch) || hatch.param < 0) continue; - final int paramID = hatch.param; + if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) continue; + int paramID = hatch.param; if(bParamsAreFloats[hatch.param] == hatch.isUsingFloats()){ hatch.input0i = iParamsOut[paramID]; hatch.input1i = iParamsOut[paramID + 10]; @@ -1197,8 +1194,8 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt parametersInRead_EM(); } else {//if has nothing to do update all for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) { - if (!isValidMetaTileEntity(hatch) || hatch.param < 0) continue; - final int paramID = hatch.param; + if (!GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(hatch) || hatch.param < 0) continue; + int paramID = hatch.param; bParamsAreFloats[hatch.param] = hatch.isUsingFloats(); iParamsIn[paramID] = hatch.value0i; iParamsIn[paramID + 10] = hatch.value1i; @@ -1285,7 +1282,7 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt for (GT_MetaTileEntity_Hatch_Param hatch : eParamHatches) hatch.getBaseMetaTileEntity().setActive(false); } - if ((ePowerPass && getEUVar()>V[3]) || (eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM())) + if (ePowerPass && getEUVar()>V[3] || eDismantleBoom && mMaxProgresstime > 0 && areChunksAroundLoaded_EM()) explodeMultiblock(); if (outputEM != null) for (cElementalInstanceStackMap output : outputEM) @@ -1713,13 +1710,13 @@ public abstract class GT_MetaTileEntity_MultiblockBase_EM extends GT_MetaTileEnt long storedEnergy = 0; long maxEnergy = 0; for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } } for (GT_MetaTileEntity_Hatch_EnergyMulti tHatch : eEnergyMulti) { - if (isValidMetaTileEntity(tHatch)) { + if (GT_MetaTileEntity_MultiBlockBase.isValidMetaTileEntity(tHatch)) { storedEnergy += tHatch.getBaseMetaTileEntity().getStoredEU(); maxEnergy += tHatch.getBaseMetaTileEntity().getEUCapacity(); } 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 c48bbc1006..61c94fdc48 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 @@ -25,9 +25,8 @@ 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_machine extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { - private Behaviour currentBehaviour; - public final static String machine="EM Machinery"; + public static final String machine="EM Machinery"; //region structure private static final String[][] shape = new String[][]{ @@ -61,8 +60,9 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_EM_machine(this.mName); + return new GT_MetaTileEntity_EM_machine(mName); } @Override @@ -92,8 +92,8 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa @Override public boolean checkRecipe_EM(ItemStack itemStack) { - currentBehaviour=map.get(new GT_ItemStack(itemStack)); - if(currentBehaviour==null) return false; + Behaviour currentBehaviour = GT_MetaTileEntity_EM_machine.map.get(new GT_ItemStack(itemStack)); + if(currentBehaviour ==null) return false; //mux input double[] parameters=new double[]{getParameterIn(0,0),getParameterIn(0,1),getParameterIn(1,0),getParameterIn(1,1), getParameterIn(2,0),getParameterIn(2,1),getParameterIn(3,0),getParameterIn(3,1)}; @@ -114,7 +114,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa if(pointer>=0 && pointer<eInputHatches.size()) handles[5]=eInputHatches.get(pointer).getContainerHandler(); for(int i=1;i<6;i++) if(handles[i]!=null) for(int j=0;j<i;j++) if (handles[i]==handles[j]) return false; - MultiblockControl<cElementalInstanceStackMap[]> control=currentBehaviour.process(handles,parameters); + MultiblockControl<cElementalInstanceStackMap[]> control= currentBehaviour.process(handles,parameters); if(control==null) return false; //update other pare outputEM=control.getValue(); @@ -165,46 +165,46 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa BitSet checkArray = new BitSet(); for (int i = 4; i <= 6; i++) { pointer = getParameterInInt(i, 0); - if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 0, STATUS_WRONG); - else if (pointer <= 0) setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); + if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else if (pointer <= 0) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); //else if(pointer==0) // setStatusOfParameterIn(i,0,STATUS_LOW); else if (pointer <= eInputHatches.size()) { if (checkArray.get(pointer)) { - setStatusOfParameterIn(i, 0, STATUS_WRONG); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); } else { - setStatusOfParameterIn(i, 0, STATUS_OK); + setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); checkArray.set(pointer); } - } else setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); + } else setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); pointer = getParameterInInt(i, 1); - if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 1, STATUS_WRONG); - else if (pointer < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - else if (pointer == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); + if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else if (pointer < 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (pointer == 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); else if (pointer <= eInputHatches.size()) { if (checkArray.get(pointer)) { - setStatusOfParameterIn(i, 1, STATUS_WRONG); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); } else { - setStatusOfParameterIn(i, 1, STATUS_OK); + setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); checkArray.set(pointer); } - } else setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); + } else setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); } } { for (int i = 7; i <= 9; i++) { pointer = getParameterInInt(i, 0); - if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 0, STATUS_WRONG); - else if (pointer < 0) setStatusOfParameterIn(i, 0, STATUS_TOO_LOW); - else if (pointer == 0) setStatusOfParameterIn(i, 0, STATUS_LOW); - else if (pointer <= eOutputHatches.size()) setStatusOfParameterIn(i, 0, STATUS_OK); - else setStatusOfParameterIn(i, 0, STATUS_TOO_HIGH); + if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else if (pointer < 0) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (pointer == 0) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (pointer <= eOutputHatches.size()) setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else setStatusOfParameterIn(i, 0, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); pointer = getParameterInInt(i, 1); - if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 1, STATUS_WRONG); - else if (pointer < 0) setStatusOfParameterIn(i, 1, STATUS_TOO_LOW); - else if (pointer == 0) setStatusOfParameterIn(i, 1, STATUS_LOW); - else if (pointer <= eOutputHatches.size()) setStatusOfParameterIn(i, 1, STATUS_OK); - else setStatusOfParameterIn(i, 1, STATUS_TOO_HIGH); + if (Double.isNaN(pointer)) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_WRONG); + else if (pointer < 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_LOW); + else if (pointer == 0) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_LOW); + else if (pointer <= eOutputHatches.size()) setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_OK); + else setStatusOfParameterIn(i, 1, GT_MetaTileEntity_MultiblockBase_EM.STATUS_TOO_HIGH); } } } @@ -215,7 +215,7 @@ public class GT_MetaTileEntity_EM_machine extends GT_MetaTileEntity_MultiblockBa map.put(is,behaviour); } - public static abstract class Behaviour { + public abstract static class Behaviour { public abstract boolean setAndCheckParametersOutAndStatuses(GT_MetaTileEntity_EM_machine te, double[] parameters); public abstract MultiblockControl<cElementalInstanceStackMap[]> process(cElementalInstanceStackMap[] inputs, double[] parameters); diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java index f3f07a2149..9574d81b84 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_Data.java @@ -122,13 +122,13 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements iConn if (tColor != aBaseMetaTileEntity.getColorization()) continue; //} } - if (tTileEntity instanceof iConnectsToDataPipe && (((iConnectsToDataPipe) tTileEntity).canConnect(j))) { - mConnections |= (1 << i); + if (tTileEntity instanceof iConnectsToDataPipe && ((iConnectsToDataPipe) tTileEntity).canConnect(j)) { + mConnections |= 1 << i; connectionCount++; } else if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToDataPipe) { if (//((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((iConnectsToDataPipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { - mConnections |= (1 << i); + mConnections |= 1 << i; connectionCount++; } } @@ -157,10 +157,10 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements iConn public iConnectsToDataPipe getNext(iConnectsToDataPipe source) { if (connectionCount != 2) return null; for (byte s = 0; s < 6; s++) { - if ((mConnections & (1 << s)) == 0) continue;//if not connected continue - final IGregTechTileEntity next = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(s); + if ((mConnections & 1 << s) == 0) continue;//if not connected continue + IGregTechTileEntity next = getBaseMetaTileEntity().getIGregTechTileEntityAtSide(s); if (next == null) continue; - final IMetaTileEntity meta = next.getMetaTileEntity(); + IMetaTileEntity meta = next.getMetaTileEntity(); if (meta instanceof iConnectsToDataPipe && meta != source) { if (meta instanceof GT_MetaTileEntity_Hatch_InputData) return (iConnectsToDataPipe) meta; @@ -190,12 +190,12 @@ public class GT_MetaTileEntity_Pipe_Data extends MetaPipeEntity implements iConn if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;} byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f; - if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f; - if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; - if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; - if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f; - if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f; + if((tConn & 1 << ForgeDirection.DOWN.ordinal()) != 0) tSide0 = 0f; + if((tConn & 1 << ForgeDirection.UP.ordinal()) != 0) tSide1 = 1f; + if((tConn & 1 << ForgeDirection.NORTH.ordinal()) != 0) tSide2 = 0f; + if((tConn & 1 << ForgeDirection.SOUTH.ordinal()) != 0) tSide3 = 1f; + if((tConn & 1 << ForgeDirection.WEST.ordinal()) != 0) tSide4 = 0f; + if((tConn & 1 << ForgeDirection.EAST.ordinal()) != 0) tSide5 = 1f; return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java index f8b5e5476d..7eb294b178 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/pipe/GT_MetaTileEntity_Pipe_EM.java @@ -121,13 +121,13 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec if (tColor != aBaseMetaTileEntity.getColorization()) continue; //} } - if (tTileEntity instanceof iConnectsToEMpipe && (((iConnectsToEMpipe) tTileEntity).canConnect(j))) { - mConnections |= (1 << i); + if (tTileEntity instanceof iConnectsToEMpipe && ((iConnectsToEMpipe) tTileEntity).canConnect(j)) { + mConnections |= 1 << i; connectionCount++; } else if (tTileEntity instanceof IGregTechTileEntity && ((IGregTechTileEntity) tTileEntity).getMetaTileEntity() instanceof iConnectsToEMpipe) { if (//((IGregTechTileEntity) tTileEntity).getCoverBehaviorAtSide(j).alwaysLookConnected(j, ((IGregTechTileEntity) tTileEntity).getCoverIDAtSide(j), ((IGregTechTileEntity) tTileEntity).getCoverDataAtSide(j), ((IGregTechTileEntity) tTileEntity)) || ((iConnectsToEMpipe) ((IGregTechTileEntity) tTileEntity).getMetaTileEntity()).canConnect(j)) { - mConnections |= (1 << i); + mConnections |= 1 << i; connectionCount++; } } @@ -170,12 +170,12 @@ public class GT_MetaTileEntity_Pipe_EM extends MetaPipeEntity implements iConnec if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;} byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f; - if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f; - if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; - if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; - if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f; - if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f; + if((tConn & 1 << ForgeDirection.DOWN.ordinal()) != 0) tSide0 = 0f; + if((tConn & 1 << ForgeDirection.UP.ordinal()) != 0) tSide1 = 1f; + if((tConn & 1 << ForgeDirection.NORTH.ordinal()) != 0) tSide2 = 0f; + if((tConn & 1 << ForgeDirection.SOUTH.ordinal()) != 0) tSide3 = 1f; + if((tConn & 1 << ForgeDirection.WEST.ordinal()) != 0) tSide4 = 0f; + if((tConn & 1 << ForgeDirection.EAST.ordinal()) != 0) tSide5 = 1f; return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java index cfb0794142..b070909181 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugPowerGenerator.java @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != aFacing) ? (aActive? GT_MetaTileEntity_Hatch_DynamoMulti.overlay[mTier]: GT_MetaTileEntity_Hatch_EnergyMulti.overlay[mTier]) : GENNY}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? aActive? GT_MetaTileEntity_Hatch_DynamoMulti.overlay[mTier]: GT_MetaTileEntity_Hatch_EnergyMulti.overlay[mTier] : GENNY}; } @Override @@ -129,8 +129,7 @@ public class GT_MetaTileEntity_DebugPowerGenerator extends GT_MetaTileEntity_Tie @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, - this.mDescription, + CommonValues.TEC_MARK_GENERAL, mDescription, EnumChatFormatting.BLUE + "Infinite Producer/Consumer", EnumChatFormatting.BLUE + "Since i wanted one..." }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java index b78ea6e572..aee848e262 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_DebugStructureWriter.java @@ -52,7 +52,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != aFacing) ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], aSide != aFacing ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : MARK}; } @Override @@ -102,7 +102,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (aBaseMetaTileEntity.isAllowedToWork()) { - result = StructureWriter(this.getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); + result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], false); for (String s : result) TecTech.Logger.info(s); aBaseMetaTileEntity.disableWorking(); @@ -111,7 +111,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - result = StructureWriter(this.getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); + result = StructureWriter(getBaseMetaTileEntity(), numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], true); for (String s : result) TecTech.Logger.info(s); } @@ -143,8 +143,7 @@ public class GT_MetaTileEntity_DebugStructureWriter extends GT_MetaTileEntity_Ti @Override public String[] getDescription() { return new String[]{ - CommonValues.TEC_MARK_GENERAL, - this.mDescription, + CommonValues.TEC_MARK_GENERAL, mDescription, EnumChatFormatting.BLUE + "Prints Multiblock NonTE structure check code", EnumChatFormatting.BLUE + "ABC axises aligned to machine front" }; diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPowerGenerator.java index f799a7b56f..f890d766aa 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugPowerGenerator.java @@ -24,25 +24,25 @@ public class GT_Container_DebugPowerGenerator @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); } @Override @@ -50,57 +50,57 @@ public class GT_Container_DebugPowerGenerator if (aSlotIndex < 0) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { GT_MetaTileEntity_DebugPowerGenerator dpg = (GT_MetaTileEntity_DebugPowerGenerator) mTileEntity.getMetaTileEntity(); switch (aSlotIndex) { case 0: - dpg.EUT -= (aShifthold == 1 ? 512 : 64); + dpg.EUT -= aShifthold == 1 ? 512 : 64; break; case 1: - dpg.EUT /= (aShifthold == 1 ? 512 : 64); + dpg.EUT /= aShifthold == 1 ? 512 : 64; break; case 2: - dpg.AMP -= (aShifthold == 1 ? 512 : 64); + dpg.AMP -= aShifthold == 1 ? 512 : 64; break; case 3: - dpg.AMP /= (aShifthold == 1 ? 512 : 64); + dpg.AMP /= aShifthold == 1 ? 512 : 64; break; case 4: - dpg.EUT -= (aShifthold == 1 ? 16 : 1); + dpg.EUT -= aShifthold == 1 ? 16 : 1; break; case 5: - dpg.EUT /= (aShifthold == 1 ? 16 : 2); + dpg.EUT /= aShifthold == 1 ? 16 : 2; break; case 6: - dpg.AMP -= (aShifthold == 1 ? 16 : 1); + dpg.AMP -= aShifthold == 1 ? 16 : 1; break; case 7: - dpg.AMP /= (aShifthold == 1 ? 16 : 2); + dpg.AMP /= aShifthold == 1 ? 16 : 2; break; case 8: - dpg.EUT += (aShifthold == 1 ? 512 : 64); + dpg.EUT += aShifthold == 1 ? 512 : 64; break; case 9: - dpg.EUT *= (aShifthold == 1 ? 512 : 64); + dpg.EUT *= aShifthold == 1 ? 512 : 64; break; case 10: - dpg.AMP += (aShifthold == 1 ? 512 : 64); + dpg.AMP += aShifthold == 1 ? 512 : 64; break; case 11: - dpg.AMP *= (aShifthold == 1 ? 512 : 64); + dpg.AMP *= aShifthold == 1 ? 512 : 64; break; case 12: - dpg.EUT += (aShifthold == 1 ? 16 : 1); + dpg.EUT += aShifthold == 1 ? 16 : 1; break; case 13: - dpg.EUT *= (aShifthold == 1 ? 16 : 2); + dpg.EUT *= aShifthold == 1 ? 16 : 2; break; case 14: - dpg.AMP += (aShifthold == 1 ? 16 : 1); + dpg.AMP += aShifthold == 1 ? 16 : 1; break; case 15: - dpg.AMP *= (aShifthold == 1 ? 16 : 2); + dpg.AMP *= aShifthold == 1 ? 16 : 2; break; default: return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } @@ -113,7 +113,7 @@ public class GT_Container_DebugPowerGenerator @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } @@ -121,9 +121,8 @@ public class GT_Container_DebugPowerGenerator EUT=dpg.EUT; AMP=dpg.AMP; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; var1.sendProgressBarUpdate(this, 100, EUT & 0xFFFF); var1.sendProgressBarUpdate(this, 101, EUT >>> 16); var1.sendProgressBarUpdate(this, 102, AMP & 0xFFFF); @@ -131,21 +130,22 @@ public class GT_Container_DebugPowerGenerator } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 100: - this.EUT = (this.EUT & 0xFFFF0000 | par2); + EUT = EUT & 0xFFFF0000 | par2; break; case 101: - this.EUT = (this.EUT & 0xFFFF | par2 << 16); + EUT = EUT & 0xFFFF | par2 << 16; break; case 102: - this.AMP = (this.AMP & 0xFFFF0000 | par2); + AMP = AMP & 0xFFFF0000 | par2; break; case 103: - this.AMP = (this.AMP & 0xFFFF | par2 << 16); + AMP = AMP & 0xFFFF | par2 << 16; break; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugStructureWriter.java index ff37e1d626..2d8098c3f9 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_Container_DebugStructureWriter.java @@ -25,25 +25,25 @@ public class GT_Container_DebugStructureWriter @Override public void addSlots(InventoryPlayer aInventoryPlayer) { - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 8, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 8, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 26, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 26, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 152, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 152, 59, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 5, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 23, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 41, false, false, 1)); - addSlotToContainer(new GT_Slot_Holo(this.mTileEntity, 2, 134, 59, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 5, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 23, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 41, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 2, 134, 59, false, false, 1)); } @Override @@ -51,46 +51,46 @@ public class GT_Container_DebugStructureWriter if (aSlotIndex < 0) { return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); } - Slot tSlot = (Slot) this.inventorySlots.get(aSlotIndex); - if ((tSlot != null) && (this.mTileEntity.getMetaTileEntity() != null)) { + Slot tSlot = (Slot) inventorySlots.get(aSlotIndex); + if (tSlot != null && mTileEntity.getMetaTileEntity() != null) { GT_MetaTileEntity_DebugStructureWriter dsw = (GT_MetaTileEntity_DebugStructureWriter) mTileEntity.getMetaTileEntity(); if (dsw.numbers == null) return null; switch (aSlotIndex) { case 0: - dsw.numbers[size ? 3 : 0] -= (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 3 : 0] -= aShifthold == 1 ? 512 : 64; return null; case 1: - dsw.numbers[size ? 4 : 1] -= (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 4 : 1] -= aShifthold == 1 ? 512 : 64; return null; case 2: - dsw.numbers[size ? 5 : 2] -= (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 5 : 2] -= aShifthold == 1 ? 512 : 64; return null; case 4: - dsw.numbers[size ? 3 : 0] -= (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 3 : 0] -= aShifthold == 1 ? 16 : 1; return null; case 5: - dsw.numbers[size ? 4 : 1] -= (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 4 : 1] -= aShifthold == 1 ? 16 : 1; return null; case 6: - dsw.numbers[size ? 5 : 2] -= (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 5 : 2] -= aShifthold == 1 ? 16 : 1; return null; case 8: - dsw.numbers[size ? 3 : 0] += (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 3 : 0] += aShifthold == 1 ? 512 : 64; return null; case 9: - dsw.numbers[size ? 4 : 1] += (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 4 : 1] += aShifthold == 1 ? 512 : 64; return null; case 10: - dsw.numbers[size ? 5 : 2] += (aShifthold == 1 ? 512 : 64); + dsw.numbers[size ? 5 : 2] += aShifthold == 1 ? 512 : 64; return null; case 12: - dsw.numbers[size ? 3 : 0] += (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 3 : 0] += aShifthold == 1 ? 16 : 1; return null; case 13: - dsw.numbers[size ? 4 : 1] += (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 4 : 1] += aShifthold == 1 ? 16 : 1; return null; case 14: - dsw.numbers[size ? 5 : 2] += (aShifthold == 1 ? 16 : 1); + dsw.numbers[size ? 5 : 2] += aShifthold == 1 ? 16 : 1; return null; case 3: case 7: @@ -106,39 +106,38 @@ public class GT_Container_DebugStructureWriter @Override public void detectAndSendChanges() { super.detectAndSendChanges(); - if ((this.mTileEntity.isClientSide()) || (this.mTileEntity.getMetaTileEntity() == null)) { + if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) { return; } GT_MetaTileEntity_DebugStructureWriter dsw = (GT_MetaTileEntity_DebugStructureWriter) mTileEntity.getMetaTileEntity(); if (numbers != null) - System.arraycopy(dsw.numbers, 0, this.numbers, 0, dsw.numbers.length); - this.size = dsw.size; + System.arraycopy(dsw.numbers, 0, numbers, 0, dsw.numbers.length); + size = dsw.size; - Iterator var2 = this.crafters.iterator(); - while (var2.hasNext()) { - ICrafting var1 = (ICrafting) var2.next(); + for (Object crafter : crafters) { + ICrafting var1 = (ICrafting) crafter; if (numbers != null) { - var1.sendProgressBarUpdate(this, 100, this.numbers[0]); - var1.sendProgressBarUpdate(this, 101, this.numbers[1]); - var1.sendProgressBarUpdate(this, 102, this.numbers[2]); - var1.sendProgressBarUpdate(this, 103, this.numbers[3]); - var1.sendProgressBarUpdate(this, 104, this.numbers[4]); - var1.sendProgressBarUpdate(this, 105, this.numbers[5]); + var1.sendProgressBarUpdate(this, 100, numbers[0]); + var1.sendProgressBarUpdate(this, 101, numbers[1]); + var1.sendProgressBarUpdate(this, 102, numbers[2]); + var1.sendProgressBarUpdate(this, 103, numbers[3]); + var1.sendProgressBarUpdate(this, 104, numbers[4]); + var1.sendProgressBarUpdate(this, 105, numbers[5]); } - var1.sendProgressBarUpdate(this, 106, this.size ? 1 : 0); + var1.sendProgressBarUpdate(this, 106, size ? 1 : 0); } } + @Override @SideOnly(Side.CLIENT) public void updateProgressBar(int par1, int par2) { super.updateProgressBar(par1, par2); switch (par1) { case 106: - this.size = par2 == 1; + size = par2 == 1; break; default: - if (numbers != null && par1 >= 100 && par1 <= 105) - this.numbers[par1 - 100] = (short) par2; + if (numbers != null && par1 >= 100 && par1 <= 105) numbers[par1 - 100] = (short) par2; break; } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java index 6946e2320e..9e6dcf1f09 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugPowerGenerator.java @@ -13,21 +13,23 @@ public class GT_GUIContainer_DebugPowerGenerator extends GT_GUIContainerMetaTile super(new GT_Container_DebugPowerGenerator(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Teleporter.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("PowerThing", 46, 8, 16448255); - if (this.mContainer != null) { + fontRendererObj.drawString("PowerThing", 46, 8, 16448255); + if (mContainer != null) { GT_Container_DebugPowerGenerator dpg = (GT_Container_DebugPowerGenerator) mContainer; - this.fontRendererObj.drawString("EUT: " + dpg.EUT, 46, 24, 16448255); - this.fontRendererObj.drawString("TIER: " + VN[Util.getTier(dpg.EUT<0?-dpg.EUT:dpg.EUT)], 46, 32, 16448255); - this.fontRendererObj.drawString("AMP: " + dpg.AMP, 46, 40, 16448255); - this.fontRendererObj.drawString("SUM: " + (long)dpg.AMP*dpg.EUT, 46, 48, 16448255); + fontRendererObj.drawString("EUT: " + dpg.EUT, 46, 24, 16448255); + fontRendererObj.drawString("TIER: " + VN[Util.getTier(dpg.EUT<0?-dpg.EUT:dpg.EUT)], 46, 32, 16448255); + fontRendererObj.drawString("AMP: " + dpg.AMP, 46, 40, 16448255); + fontRendererObj.drawString("SUM: " + (long)dpg.AMP*dpg.EUT, 46, 48, 16448255); } } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugStructureWriter.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugStructureWriter.java index 2192017c6c..aaa0d0a505 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugStructureWriter.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/gui/GT_GUIContainer_DebugStructureWriter.java @@ -11,22 +11,24 @@ public class GT_GUIContainer_DebugStructureWriter extends GT_GUIContainerMetaTil super(new GT_Container_DebugStructureWriter(aInventoryPlayer, aTileEntity), RES_PATH_GUI + "Teleporter.png"); } + @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { - this.fontRendererObj.drawString("StructPrint", 46, 8, 16448255); - if (this.mContainer != null) { + fontRendererObj.drawString("StructPrint", 46, 8, 16448255); + if (mContainer != null) { GT_Container_DebugStructureWriter dsw = (GT_Container_DebugStructureWriter) mContainer; if (dsw.numbers == null) return; - this.fontRendererObj.drawString(dsw.size ? "Size" : "Offset", 46, 16, 16448255); - this.fontRendererObj.drawString("A: " + dsw.numbers[dsw.size ? 3 : 0], 46, 24, 16448255); - this.fontRendererObj.drawString("B: " + dsw.numbers[dsw.size ? 4 : 1], 46, 32, 16448255); - this.fontRendererObj.drawString("C: " + dsw.numbers[dsw.size ? 5 : 2], 46, 40, 16448255); + fontRendererObj.drawString(dsw.size ? "Size" : "Offset", 46, 16, 16448255); + fontRendererObj.drawString("A: " + dsw.numbers[dsw.size ? 3 : 0], 46, 24, 16448255); + fontRendererObj.drawString("B: " + dsw.numbers[dsw.size ? 4 : 1], 46, 32, 16448255); + fontRendererObj.drawString("C: " + dsw.numbers[dsw.size ? 5 : 2], 46, 40, 16448255); } } + @Override protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { super.drawGuiContainerBackgroundLayer(par1, par2, par3); - int x = (this.width - this.xSize) / 2; - int y = (this.height - this.ySize) / 2; - drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); } } diff --git a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java index faf251536f..20421365f0 100644 --- a/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java +++ b/src/main/java/com/github/technus/tectech/thing/tileEntity/ReactorSimTileEntity.java @@ -19,7 +19,6 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { private boolean hadRedstone =true; public ReactorSimTileEntity() { - super(); //this.updateTicker = IC2.random.nextInt(this.getTickRate()); //this.inputTank = new FluidTank(10000); //this.outputTank = new FluidTank(10000); @@ -33,12 +32,13 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public void onLoaded() { super.onLoaded(); - if(IC2.platform.isSimulating() && this.addedToEnergyNet) { + if(IC2.platform.isSimulating() && addedToEnergyNet) { MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); //this.addedToEnergyNet = false; } } + @Override public void onUnloaded() { addedToEnergyNet=false; super.onUnloaded(); @@ -100,7 +100,7 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public double getReactorEUEnergyOutput() { - return (double)(this.getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); + return (double)(getReactorEnergyOutput() * 5.0F * ConfigUtil.getFloat(MainConfig.get(), "balance/energy/generator/nuclear")); } //public List<TileEntity> getSubTiles() { @@ -153,8 +153,8 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override protected void updateEntityServer() { - if(this.updateTicker++ % this.getTickRate() == 0) { - if (!worldObj.isRemote && this.worldObj.doChunksNearChunkExist(this.xCoord, this.yCoord, this.zCoord, 2)) { + if(updateTicker++ % getTickRate() == 0) { + if (!worldObj.isRemote && worldObj.doChunksNearChunkExist(xCoord, yCoord, zCoord, 2)) { if(hadRedstone && !receiveredstone()) hadRedstone=false; else if(!hadRedstone && receiveredstone()){ doUpdates(); @@ -203,10 +203,10 @@ public class ReactorSimTileEntity extends TileEntityNuclearReactorElectric { @Override public boolean calculateHeatEffects() { - if(this.heat >= 4000 && IC2.platform.isSimulating()) { - float power = (float)this.heat / (float)this.maxHeat; + if(heat >= 4000 && IC2.platform.isSimulating()) { + float power = (float) heat / (float) maxHeat; if(power >= 1.0F) { - this.explode();//ding + explode();//ding return true; } else { //int[] coord; diff --git a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseEM.java b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseEM.java index 02d9c59cfe..d79ab16f12 100644 --- a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseEM.java +++ b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseEM.java @@ -19,12 +19,11 @@ public class TurretBaseEM extends BlockAbstractTurretBase { public static TurretBaseEM INSTANCE; public TurretBaseEM(){ - super(); setCreativeTab(TecTech.mainTab); - this.setResistance(16); - this.setBlockName("turretBaseEM"); - this.setStepSound(Block.soundTypeMetal); - this.setBlockTextureName(Reference.MODID+":turretBaseEM"); + setResistance(16); + setBlockName("turretBaseEM"); + setStepSound(Block.soundTypeMetal); + setBlockTextureName(Reference.MODID+":turretBaseEM"); } @Override @@ -32,9 +31,10 @@ public class TurretBaseEM extends BlockAbstractTurretBase { return new TileTurretBaseEM(MaxCharge,MaxIO); } + @Override public void registerBlockIcons(IIconRegister p_149651_1_) { super.registerBlockIcons(p_149651_1_); - this.blockIcon = p_149651_1_.registerIcon(Reference.MODID+":turretBaseEM"); + blockIcon = p_149651_1_.registerIcon(Reference.MODID+":turretBaseEM"); } public static void run() { diff --git a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java index c7b3b547c0..5bbfee8b1e 100644 --- a/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java +++ b/src/main/java/openmodularturrets/blocks/turretbases/TurretBaseItemEM.java @@ -18,6 +18,7 @@ public class TurretBaseItemEM extends ItemBlock { super(b); } + @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { list.add(CommonValues.TEC_MARK_EM); list.add(""); diff --git a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadEM.java b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadEM.java index 90318ef390..e7746a8291 100644 --- a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadEM.java +++ b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadEM.java @@ -20,12 +20,12 @@ public class TurretHeadEM extends Block implements ITileEntityProvider { public TurretHeadEM(){ super(Material.glass); - this.setCreativeTab(TecTech.mainTab); - this.setBlockUnbreakable(); - this.setResistance(6000000.0F); - this.setStepSound(Block.soundTypeMetal); - this.setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 1F, 0.8F); - this.setBlockName("turretHeadEM"); + setCreativeTab(TecTech.mainTab); + setBlockUnbreakable(); + setResistance(6000000.0F); + setStepSound(Block.soundTypeMetal); + setBlockBounds(0.2F, 0.0F, 0.2F, 0.8F, 1F, 0.8F); + setBlockName("turretHeadEM"); //this.setBlockTextureName(Reference.MODID+":turretHeadEM"); } diff --git a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java index 742e7b94fe..e368973f7a 100644 --- a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java +++ b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemEM.java @@ -23,6 +23,7 @@ public class TurretHeadItemEM extends ItemBlock { super(b); } + @Override public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List list, boolean p_77624_4_) { list.add(TEC_MARK_EM); list.add(""); diff --git a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java index 6a46c627f2..4760e2b16e 100644 --- a/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java +++ b/src/main/java/openmodularturrets/blocks/turretheads/TurretHeadItemRenderEM.java @@ -17,21 +17,24 @@ public class TurretHeadItemRenderEM implements IItemRenderer { public TurretHeadItemRenderEM(TurretHeadRenderEM turretRenderer, TileTurretHeadEM turretTileEntity) { this.turretRenderer = turretRenderer; this.turretTileEntity = turretTileEntity; - this.model = new ModelLaserTurret(); + model = new ModelLaserTurret(); } + @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { return true; } + @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } + @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { GL11.glPushMatrix(); GL11.glTranslated(-0.5D, -0.5D, -0.5D); - this.turretRenderer.renderTileEntityAt(this.turretTileEntity, 0.0D, 0.0D, 0.0D, 0.0F); + turretRenderer.renderTileEntityAt(turretTileEntity, 0.0D, 0.0D, 0.0D, 0.0F); GL11.glPopMatrix(); } } diff --git a/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java b/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java index e857d748e7..28f305c85b 100644 --- a/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java +++ b/src/main/java/openmodularturrets/entity/projectiles/projectileEM.java @@ -54,8 +54,8 @@ public class projectileEM extends TurretProjectile { if(consumeFromThis.definition.getType()>1 || consumeFromThis.definition.getType()<-1) exotic = true; if(consumeFromThis.definition.getType()<0) antiMatter = true; - if (consumeFromThis.definition.getCharge() == 0) this.gravity = massFactor/100f; - else this.gravity = Math.min(0.0025F/Math.abs(consumeFromThis.definition.getCharge()),massFactor/100f); + if (consumeFromThis.definition.getCharge() == 0) gravity = massFactor/100f; + else gravity = Math.min(0.0025F/Math.abs(consumeFromThis.definition.getCharge()),massFactor/100f); avalableEM.removeAmount(false,consumeFromThis.definition.getStackForm(1)); } @@ -65,13 +65,14 @@ public class projectileEM extends TurretProjectile { //todo add more subspace pollution } + @Override protected void onImpact(MovingObjectPosition movingobjectposition) { - if(this.ticksExisted > 1) { + if(ticksExisted > 1) { if(movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - Block hitBlock = this.worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); + Block hitBlock = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ); if(hitBlock != null){ if (hitBlock.getMaterial().isSolid() && TecTech.ModConfig.ENABLE_TURRET_EXPLOSIONS && antiMatter) { - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.Rnd.nextFloat() + 0.5F); + worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.Rnd.nextFloat() + 0.5F); GT_Utility.sendSoundToPlayers(worldObj, GregTech_API.sSoundList.get(209), 1.0F, -1.0F, movingobjectposition.blockX, movingobjectposition.blockY, @@ -79,20 +80,20 @@ public class projectileEM extends TurretProjectile { worldObj.createExplosion(null, movingobjectposition.blockX + 0.5D, movingobjectposition.blockY + 0.5D, - movingobjectposition.blockZ + 0.5D, (exotic?10:1) * TecTech.ModConfig.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped?(amp_level*.1f)+1:1) * (ticksExisted/250f), true); + movingobjectposition.blockZ + 0.5D, (exotic?10:1) * TecTech.ModConfig.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? amp_level*.1f +1:1) * (ticksExisted/250f), true); } else { return; } } } - if(movingobjectposition.entityHit != null && !this.worldObj.isRemote) { - this.worldObj.playSoundEffect(this.posX, this.posY, this.posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.Rnd.nextFloat() + 0.5F); - if(movingobjectposition.entityHit != null && !this.worldObj.isRemote) { - float damage = (exotic?10:1) * TecTech.ModConfig.TURRET_DAMAGE_FACTOR * massFactor * (isAmped?(amp_level*.1f)+1:1); + if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + worldObj.playSoundEffect(posX, posY, posZ, "openmodularturrets:laserHit", ConfigHandler.getTurretSoundVolume(), TecTech.Rnd.nextFloat() + 0.5F); + if(movingobjectposition.entityHit != null && !worldObj.isRemote) { + float damage = (exotic?10:1) * TecTech.ModConfig.TURRET_DAMAGE_FACTOR * massFactor * (isAmped? amp_level*.1f +1:1); if(movingobjectposition.entityHit instanceof EntityPlayer) { - if(this.canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { + if(canDamagePlayer((EntityPlayer)movingobjectposition.entityHit)) { movingobjectposition.entityHit.setFire((exotic?10:1)*2); movingobjectposition.entityHit.attackEntityFrom(new NormalDamageSource("laser"), damage); if(antiMatter) movingobjectposition.entityHit.hurtResistantTime = 0; @@ -111,17 +112,18 @@ public class projectileEM extends TurretProjectile { worldObj.createExplosion(null, movingobjectposition.entityHit.posX, movingobjectposition.entityHit.posY, - movingobjectposition.entityHit.posZ, (exotic?10:1) * TecTech.ModConfig.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped?(amp_level*.1f)+1:1) * (ticksExisted/250f), true); + movingobjectposition.entityHit.posZ, (exotic?10:1) * TecTech.ModConfig.TURRET_EXPLOSION_FACTOR * massFactor * (isAmped? amp_level*.1f +1:1) * (ticksExisted/250f), true); } } } - this.setDead(); + setDead(); } } + @Override public void onEntityUpdate() { - if(this.ticksExisted >= 75) { - this.setDead(); + if(ticksExisted >= 75) { + setDead(); } } } diff --git a/src/main/java/openmodularturrets/entity/projectiles/projectileRenderEM.java b/src/main/java/openmodularturrets/entity/projectiles/projectileRenderEM.java index 0fb915e035..7580ee1c5c 100644 --- a/src/main/java/openmodularturrets/entity/projectiles/projectileRenderEM.java +++ b/src/main/java/openmodularturrets/entity/projectiles/projectileRenderEM.java @@ -22,7 +22,7 @@ public class projectileRenderEM extends Render { } private void render(projectileEM entity, double par2, double par4, double par6, float par9) { - this.bindEntityTexture(entity); + bindEntityTexture(entity); GL11.glPushMatrix(); GL11.glTranslatef((float)par2, (float)par4 + 0.3F, (float)par6); GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); @@ -64,10 +64,12 @@ public class projectileRenderEM extends Render { GL11.glPopMatrix(); } + @Override protected ResourceLocation getEntityTexture(Entity par1Entity) { return textures; } + @Override public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { render((projectileEM)par1Entity, par2, par4, par6, par9); } diff --git a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java index 343a1e5ebd..eab654f486 100644 --- a/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java +++ b/src/main/java/openmodularturrets/tileentity/turret/TileTurretHeadEM.java @@ -22,18 +22,22 @@ public class TileTurretHeadEM extends TurretHead{ public TileTurretHeadEM() { } + @Override public int getTurretRange() { return ConfigHandler.getLaserTurretSettings().getRange()<<1; } + @Override public int getTurretPowerUsage() { return ConfigHandler.getLaserTurretSettings().getPowerUsage()<<4; } + @Override public int getTurretFireRate() { return (int)Math.ceil(ConfigHandler.getLaserTurretSettings().getFireRate()/2f); } + @Override public double getTurretAccuracy() { return (int)Math.ceil(ConfigHandler.getLaserTurretSettings().getAccuracy() / 10.0F); } @@ -45,22 +49,27 @@ public class TileTurretHeadEM extends TurretHead{ super.updateEntity(); } + @Override public boolean requiresAmmo() { return hatchContentPointer == null || !hatchContentPointer.hasStacks(); } + @Override public boolean requiresSpecificAmmo() { return true;//to enable failure in shooting when there is no EM to use } + @Override public Item getAmmo() { return DebugElementalInstanceContainer_EM.INSTANCE;//Placeholder item that cannot be achieved, yet still usable for debug } + @Override public final TurretProjectile createProjectile(World world, Entity target, ItemStack ammo) { return new projectileEM(world, TurretHeadUtil.getTurretBase(worldObj, xCoord, yCoord, zCoord), hatchContentPointer); } + @Override public String getLaunchSoundEffect() { return "laser"; } diff --git a/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java b/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java index acecfb4a37..3a0679aee6 100644 --- a/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java +++ b/src/main/java/openmodularturrets/tileentity/turretbase/TileTurretBaseEM.java @@ -16,6 +16,7 @@ public class TileTurretBaseEM extends TurretBaseTierFiveTileEntity { super(MaxEnergyStorage, MaxIO); } + @Override @Optional.Method( modid = "OpenComputers" ) |