From fcae1a1801296af53761c9a04dce89d35e235fbe Mon Sep 17 00:00:00 2001 From: Technus Date: Mon, 5 Sep 2016 15:05:47 +0200 Subject: [PATCH] Materials update, whitespaces, Higher tier method adjustment for long computaion. --- .../java/gregtech/api/enums/Materials.java | 5 ++--- .../tileentity/IEnergyConnected.java | 3 ++- .../gregtech/api/items/GT_MetaBase_Item.java | 2 ++ .../GT_MetaPipeEntity_Cable.java | 3 ++- .../GT_MetaTileEntity_BasicBatteryBuffer.java | 6 +++--- .../GT_MetaTileEntity_BasicGenerator.java | 4 ++-- .../GT_MetaTileEntity_BasicMachine.java | 2 +- ...MetaTileEntity_BasicMachine_GT_Recipe.java | 19 ++++++++++++++----- .../GT_MetaTileEntity_Buffer.java | 6 +++--- .../GT_MetaTileEntity_Hatch_Dynamo.java | 2 +- .../GT_MetaTileEntity_Hatch_Energy.java | 2 +- .../GT_MetaTileEntity_TieredMachineBlock.java | 4 +++- .../GT_MetaTileEntity_Transformer.java | 9 +++++---- ..._MetaTileEntity_MagicalEnergyAbsorber.java | 2 +- 14 files changed, 42 insertions(+), 27 deletions(-) diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index 7496b45b..525dd0fb 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -680,15 +680,14 @@ public enum Materials implements IColorModulationContainer, ISubTagContainer { //Infinity //Others, new ones?... - /** * Materials which are renamed automatically */ //@Deprecated Duralium (Duralumin,false), //@Deprecated Dural (Duralumin,false), - //@Deprecated Duralum (Duralumin,false), + //@Deprecated Duralum (Duralumin,false), //@Deprecated Duraluminium (Duralumin,false), - //@Deprecated Duraluminum (Duralumin,false), + //@Deprecated Duraluminum (Duralumin,false), @Deprecated IridiumAndSodiumOxide(IridiumSodiumOxide, false), @Deprecated Palygorskite (FullersEarth, false), @Deprecated Adamantine (Adamantium, true), diff --git a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java index ba9ecedb..750c207a 100644 --- a/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java +++ b/src/main/java/gregtech/api/interfaces/tileentity/IEnergyConnected.java @@ -71,7 +71,8 @@ public interface IEnergyConnected extends IColoredTileEntity, IHasWorldObjectAnd } } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); + long rfOUT = aVoltage * GregTech_API.mEUtoRF / 100; + int rfOut = rfOUT>Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)rfOUT; if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; diff --git a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java index a921377a..38898548 100644 --- a/src/main/java/gregtech/api/items/GT_MetaBase_Item.java +++ b/src/main/java/gregtech/api/items/GT_MetaBase_Item.java @@ -259,7 +259,9 @@ public abstract class GT_MetaBase_Item extends GT_Generic_Item implements ISpeci Long[] tStats = getElectricStats(aStack); if (tStats == null || tStats[2] > aTier || !(tStats[3] == -1 || tStats[3] == -3 || (tStats[3] < 0 && aCharge == Integer.MAX_VALUE)) || aStack.stackSize != 1) return 0; + //REALLY?? THIS IS THE CULPRIT THAT CHARGES ITEMS AT INSTANT!!! long tChargeBefore = getRealCharge(aStack), tNewCharge = aCharge == Integer.MAX_VALUE ? Long.MAX_VALUE : Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); + // long tChargeBefore = getRealCharge(aStack), tNewCharge = Math.min(Math.abs(tStats[0]), tChargeBefore + (aIgnoreTransferLimit ? (long) aCharge : Math.min(tStats[1], (long) aCharge))); if (!aSimulate) setCharge(aStack, tNewCharge); return tNewCharge - tChargeBefore; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 15ae1204..f5993c9d 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -176,7 +176,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } } else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) { ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite(); - int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100); + long rfOUT = aVoltage * GregTech_API.mEUtoRF / 100; + int rfOut = rfOUT>Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)rfOUT; if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) { ((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java index 21c993ce..053361cb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java @@ -110,12 +110,12 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public long getMinimumStoredEU() { - return V[mTier] * 16 * mInventory.length; + return V[mTier] * 16L * mInventory.length; } @Override public long maxEUStore() { - return V[mTier] * 64 * mInventory.length; + return V[mTier] * 64L * mInventory.length; } @Override @@ -130,7 +130,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier @Override public long maxAmperesIn() { - return mChargeableCount * 2; + return mChargeableCount * 2L; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java index 6f164650..bbb16a8a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java @@ -131,12 +131,12 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity @Override public long maxEUOutput() { - return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0; + return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0L; } @Override public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 40 + getMinimumStoredEU()); + return Math.max(getEUVar(), V[mTier] * 40L + getMinimumStoredEU()); } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 80852970..f144bba6 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -539,7 +539,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B tempEUt *= 4;//this actually controls overclocking xEUt *= 4;//this is effect of everclocking mMaxProgresstime /= 2;//this is effect of overclocking - xEUt= mMaxProgresstime==0 ? xEUt/2 : xEUt;//U know if the time is 1 tick make the machine use 2x less power + xEUt= mMaxProgresstime==0 ? xEUt/2 : xEUt;//U know, if the time is 1 tick make the machine use 2x less power } if(xEUt>Integer.MAX_VALUE-1){ mEUt=Integer.MAX_VALUE-1; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index fb863ef3..1362d958 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -45,6 +45,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ mGUIParameterA = (byte) aGUIParameterA; mGUIParameterB = (byte) aGUIParameterB; + + //TODO: CHECK if (aRecipe != null) { for (int i = 3; i < aRecipe.length; i++) { if (aRecipe[i] == X.CIRCUIT) { @@ -73,6 +75,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ case 6: case 7: case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: aRecipe[i] = Ic2Items.reinforcedGlass; break; default: @@ -110,7 +119,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium); break; default: - aRecipe[i] = OrePrefixes.plate.get(Materials.TungstenSteel); + aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium); break; } continue; @@ -144,7 +153,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe[i] = OrePrefixes.pipeLarge.get(Materials.Ultimate); break; default: - aRecipe[i] = OrePrefixes.pipeMedium.get(Materials.TungstenSteel); + aRecipe[i] = OrePrefixes.pipeMedium.get(Materials.Ultimate); break; } continue; @@ -178,7 +187,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe[i] = OrePrefixes.wireGt02.get(Materials.NaquadahAlloy); break; default: - aRecipe[i] = OrePrefixes.wireGt08.get(Materials.Nichrome); + aRecipe[i] = OrePrefixes.wireGt08.get(Materials.NaquadahAlloy); break; } continue; @@ -212,7 +221,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ aRecipe[i] = OrePrefixes.wireGt04.get(Materials.NaquadahAlloy); break; default: - aRecipe[i] = OrePrefixes.wireGt16.get(Materials.Nichrome); + aRecipe[i] = OrePrefixes.wireGt16.get(Materials.NaquadahAlloy); break; } continue; @@ -686,5 +695,5 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ return !mSharedTank; } - public static enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, CIRCUIT, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, BETTER_CIRCUIT, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC;} + public static enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, CIRCUIT, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, BETTER_CIRCUIT, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC} } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index cffa8883..f4dd133a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -137,12 +137,12 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public long getMinimumStoredEU() { - return 512; + return 512L; } @Override public long maxEUStore() { - return 512 + V[mTier] * 50; + return 512L + V[mTier] * 50L; } @Override @@ -152,7 +152,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM @Override public long maxEUOutput() { - return bOutput ? V[mTier] : 0; + return bOutput ? V[mTier] : 0L; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java index 2eda016f..545dd34f 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java @@ -70,7 +70,7 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch { @Override public long maxEUStore() { - return 512 + V[mTier + 1] * 2; + return 512L + V[mTier + 1] * 2L; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java index 91bf149e..66ea9f8a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java @@ -70,7 +70,7 @@ public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch { @Override public long maxEUStore() { - return 512 + V[mTier] * 8; + return 512L + V[mTier] * 8L; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java index a37bacff..54cede85 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java @@ -1,5 +1,6 @@ package gregtech.api.metatileentity.implementations; +import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; import gregtech.api.metatileentity.MetaTileEntity; @@ -8,6 +9,7 @@ import static gregtech.api.enums.GT_Values.GT; public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntity { /** * Value between [0 - 9] to describe the Tier of this Machine. + * PLZ [0-15] works - READ! GT_Values class. */ public final byte mTier; @@ -23,7 +25,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) { super(aID, aName, aNameRegional, aInvSlotCount); - mTier = (byte) Math.max(0, Math.min(aTier, 9)); + mTier = (byte) Math.max(0, Math.min(aTier, 15)); mDescription = aDescription; // must always be the last call! diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java index d91aafaa..c5954593 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java @@ -112,7 +112,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public long maxEUStore() { - return 512 + V[mTier + 1] * 2; + return 512L + V[mTier + 1] * 2L; } @Override @@ -127,12 +127,12 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi @Override public long maxAmperesOut() { - return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier + 1] / V[mTier] : 1; + return getBaseMetaTileEntity().isAllowedToWork() ? (V[mTier + 1] / V[mTier] < 4 ? 4 : V[mTier + 1] / V[mTier]) : 1; } @Override public long maxAmperesIn() { - return getBaseMetaTileEntity().isAllowedToWork() ? 1 : V[mTier + 1] / V[mTier]; + return getBaseMetaTileEntity().isAllowedToWork() ? 1 : (V[mTier + 1] / V[mTier] < 4 ? 4 : V[mTier + 1] / V[mTier]); } @Override @@ -156,7 +156,8 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1); } else if (GregTech_API.mInputRF && GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) { int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored(); - int extractRF = (int) maxEUInput() * 100 / GregTech_API.mRFtoEU; + long EXTRACTRF = maxEUInput() * 100 / GregTech_API.mRFtoEU; + int extractRF = EXTRACTRF>Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)EXTRACTRF; long tEU = 0; if (tTileEntity instanceof TileCapBank) { ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork(); diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index a7438235..36d5f0b3 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -239,7 +239,7 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B @Override public long maxEUStore() { - return Math.max(getEUVar(), V[mTier] * 16000 + getMinimumStoredEU()); + return Math.max(getEUVar(), V[mTier] * 16000L + getMinimumStoredEU()); } public ITexture[] getFront(byte aColor) {