From 7832b6223896af1b1435cdfeb52ce0210bfd2203 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Wed, 30 Jan 2019 02:18:50 +0000 Subject: $ Fixed 'bug' where GT wooden Pipes/Frames would require an Axe to harvest. They now require a wrench, freeing up 4 MetaIDs on BlockMachines for myself to use. $ Fixed handling of custom BaseMetaTileEntity implementations. Meta 12-15 is now used by GT++ to deploy custom without requiring any outside items or blocks. $ Fixed IC2 items requiring a pickaxe to mine and shitty wrench handling. You can now just mine them as usual with a wrench. $ Fixed ALL GT/GT++ Tile Entity Tooltips. Formatted some things slighty, added additional information and additional custom tooltip support. --- .../api/metatileentity/BaseCustomTileEntity.java | 386 +-------------------- .../custom/power/BaseCustomPower_MTE.java | 59 ++-- .../custom/power/GTPP_MTE_TieredMachineBlock.java | 7 +- .../custom/power/MetaTileEntityCustomPower.java | 15 + .../GT_MetaTileEntity_BasicBreaker.java | 21 +- .../GT_MetaTileEntity_Hatch_InputBattery.java | 3 +- .../GT_MetaTileEntity_Hatch_OutputBattery.java | 3 +- .../GregtechMetaPipeEntityFluid.java | 2 +- .../GregtechMetaPipeEntity_Cable.java | 2 +- .../GregtechMetaTreeFarmerStructural.java | 2 +- .../implementations/base/CustomMetaTileBase.java | 40 ++- .../base/GregtechMetaTileEntity.java | 2 +- .../base/GregtechMetaTransformerHiAmp.java | 2 +- .../base/GregtechMeta_MultiBlockBase.java | 6 +- .../GregtechDoubleFuelGeneratorBase.java | 2 +- .../GregtechRocketFuelGeneratorBase.java | 6 +- 16 files changed, 106 insertions(+), 452 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api') diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java index 214fcc6a3f..939cac2779 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/BaseCustomTileEntity.java @@ -8,33 +8,22 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import ic2.api.Direction; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; public class BaseCustomTileEntity extends BaseMetaTileEntity { - - protected boolean mHasEnoughEnergy; - - protected short mID; - protected long oOutput; - - protected long mAcceptedAmperes; - protected NBTTagCompound mRecipeStuff; - - - - protected boolean[] mActiveEUInputs; - protected boolean[] mActiveEUOutputs; + + protected NBTTagCompound mRecipeStuff2; public BaseCustomTileEntity() { super(); + Logger.INFO("Created new BaseCustomTileEntity"); } public void writeToNBT(NBTTagCompound aNBT) { @@ -47,184 +36,20 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } try { - aNBT.setInteger("nbtVersion", GT_Mod.TOTAL_VERSION); + if (!aNBT.hasKey("ModVersion")) + aNBT.setString("ModVersion", CORE.VERSION); } catch (Throwable arg6) { GT_Log.err.println( "Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould\'ve been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!"); arg6.printStackTrace(GT_Log.err); } - - } - - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - this.setInitialValuesAsNBT(aNBT, (short) 0); - } - - public void updateStatus() { - } - - public void chargeItem(ItemStack aStack) { - this.decreaseStoredEU( - (long) GT_ModHandler.chargeElectricItem(aStack, (int) Math.min(2147483647L, this.getStoredEU()), - (int) Math.min(2147483647L, this.mMetaTileEntity.getOutputTier()), false, false), - true); - } - - public void dischargeItem(ItemStack aStack) { - this.increaseStoredEnergyUnits((long) GT_ModHandler.dischargeElectricItem(aStack, - (int) Math.min(2147483647L, this.getEUCapacity() - this.getStoredEU()), - (int) Math.min(2147483647L, this.mMetaTileEntity.getInputTier()), false, false, false), true); - } - - public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { - return !this.canAccessData() ? false - : (this.mHasEnoughEnergy = this.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy) - || this.decreaseStoredSteam(aEnergy, false) - || aIgnoreTooLessEnergy && this.decreaseStoredSteam(aEnergy, true)); - } - - public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) { - if (!this.canAccessData()) { - return false; - } else if (this.getStoredEU() >= this.getEUCapacity() && !aIgnoreTooMuchEnergy) { - return false; - } else { - this.setStoredEU(this.mMetaTileEntity.getEUVar() + aEnergy); - return true; - } - } - - public boolean inputEnergyFrom(byte aSide) { - return aSide == 6 ? true - : (!this.isServerSide() ? this.isEnergyInputSide(aSide) - : aSide >= 0 && aSide < 6 && this.mActiveEUInputs[aSide] && !this.mReleaseEnergy); - } - - public boolean outputsEnergyTo(byte aSide) { - return aSide == 6 ? true - : (!this.isServerSide() ? this.isEnergyOutputSide(aSide) - : aSide >= 0 && aSide < 6 && this.mActiveEUOutputs[aSide] || this.mReleaseEnergy); - } - - public long getOutputAmperage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesOut() : 0L; - } - - public long getOutputVoltage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput() - ? this.mMetaTileEntity.maxEUOutput() - : 0L; - } - - public long getInputAmperage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxAmperesIn() : 0L; - } - - public long getInputVoltage() { - return this.canAccessData() && this.mMetaTileEntity.isElectric() ? this.mMetaTileEntity.maxEUInput() - : 2147483647L; - } - - public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) { - if (!this.canAccessData()) { - return false; - } else if (this.mMetaTileEntity.getSteamVar() >= this.getSteamCapacity() && !aIgnoreTooMuchEnergy) { - return false; - } else { - this.setStoredSteam(this.mMetaTileEntity.getSteamVar() + aEnergy); - return true; - } - } - - public long getUniversalEnergyStored() { - return Math.max(this.getStoredEU(), this.getStoredSteam()); - } - - public long getUniversalEnergyCapacity() { - return Math.max(this.getEUCapacity(), this.getSteamCapacity()); - } - - public long getStoredEU() { - return this.canAccessData() ? Math.min(this.mMetaTileEntity.getEUVar(), this.getEUCapacity()) : 0L; - } - - public long getEUCapacity() { - return this.canAccessData() ? this.mMetaTileEntity.maxEUStore() : 0L; - } - - private boolean isEnergyInputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!this.getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, this.getCoverIDAtSide(aSide), - this.getCoverDataAtSide(aSide), this)) { - return false; - } - - if (this.isInvalid() || this.mReleaseEnergy) { - return false; - } - - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetInput()) { - return this.mMetaTileEntity.isInputFacing(aSide); - } - } - - return false; - } - - private boolean isEnergyOutputSide(byte aSide) { - if (aSide >= 0 && aSide < 6) { - if (!this.getCoverBehaviorAtSide(aSide).letsEnergyOut(aSide, this.getCoverIDAtSide(aSide), - this.getCoverDataAtSide(aSide), this)) { - return false; - } - - if (this.isInvalid() || this.mReleaseEnergy) { - return this.mReleaseEnergy; - } - - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.mMetaTileEntity.isEnetOutput()) { - return this.mMetaTileEntity.isOutputFacing(aSide); - } - } - - return false; - } - - public boolean setStoredEU(long aEnergy) { - if (!this.canAccessData()) { - return false; - } else { - if (aEnergy < 0L) { - aEnergy = 0L; - } - - this.mMetaTileEntity.setEUVar(aEnergy); - return true; - } - } - - public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { - if (!this.canAccessData()) { - return false; - } else if (this.mMetaTileEntity.getEUVar() - aEnergy < 0L && !aIgnoreTooLessEnergy) { - return false; - } else { - this.setStoredEU(this.mMetaTileEntity.getEUVar() - aEnergy); - if (this.mMetaTileEntity.getEUVar() < 0L) { - this.setStoredEU(0L); - return false; - } else { - return true; - } - } } public void doEnergyExplosion() { if (this.getUniversalEnergyCapacity() > 0L && this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 5L) { this.doExplosion( - this.oOutput * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 + this.getOutput() * (long) (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() ? 4 : (this.getUniversalEnergyStored() >= this.getUniversalEnergyCapacity() / 2L ? 2 : 1))); GT_Mod arg9999 = GT_Mod.instance; GT_Mod.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(this.getOwnerName()), @@ -257,11 +82,9 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } } - if (this.mRecipeStuff != null) { + if (this.mRecipeStuff2 != null) { for (i = 0; i < 9; ++i) { - if (this.getRandomNumber(100) < 50) { - this.dropItems(GT_Utility.loadItem(this.mRecipeStuff, "Ingredient." + i)); - } + this.dropItems(GT_Utility.loadItem(this.mRecipeStuff2, "Ingredient." + i)); } } @@ -272,7 +95,7 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { } public ArrayList getDrops() { - ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, this.mID); + ItemStack rStack = new ItemStack(Meta_GT_Proxy.sBlockMachines, 1, this.getMetaTileID()); NBTTagCompound aSuperNBT = super.getDrops().get(0).getTagCompound(); NBTTagCompound tNBT = aSuperNBT; if (this.hasValidMetaTileEntity()) { @@ -285,195 +108,8 @@ public class BaseCustomTileEntity extends BaseMetaTileEntity { return new ArrayList(Arrays.asList(new ItemStack[] { rStack })); } - public long getAverageElectricInput() { - int rEU = 0; - - for (int i = 0; i < this.mAverageEUInput.length; ++i) { - if (i != this.mAverageEUInputIndex) { - rEU += this.mAverageEUInput[i]; - } - } - - return (long) (rEU / (this.mAverageEUInput.length - 1)); - } - - public long getAverageElectricOutput() { - int rEU = 0; - - for (int i = 0; i < this.mAverageEUOutput.length; ++i) { - if (i != this.mAverageEUOutputIndex) { - rEU += this.mAverageEUOutput[i]; - } - } - - return (long) (rEU / (this.mAverageEUOutput.length - 1)); - } - - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L - && aVoltage > 0L && this.getStoredEU() < this.getEUCapacity() - && this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes) { - if (aVoltage > this.getInputVoltage()) { - this.doExplosion(aVoltage); - return 0L; - } else if (this - .increaseStoredEnergyUnits( - aVoltage * (aAmperage = Math - .min(aAmperage, - Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes, - 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))), - true)) { - this.mAverageEUInput[this.mAverageEUInputIndex] = (int) ((long) this.mAverageEUInput[this.mAverageEUInputIndex] - + aVoltage * aAmperage); - this.mAcceptedAmperes += aAmperage; - return aAmperage; - } else { - return 0L; - } - } else { - return 0L; - } - } - - public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) - && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { - if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((long) this.mAverageEUOutput[this.mAverageEUOutputIndex] - + aVoltage * aAmperage); - return true; - } else { - return false; - } - } else { - return false; - } - } - - public boolean acceptsRotationalEnergy(byte aSide) { - return this.canAccessData() && this.getCoverIDAtSide(aSide) == 0 - ? this.mMetaTileEntity.acceptsRotationalEnergy(aSide) - : false; - } - - public boolean injectRotationalEnergy(byte aSide, long aSpeed, long aEnergy) { - return this.canAccessData() && this.getCoverIDAtSide(aSide) == 0 - ? this.mMetaTileEntity.injectRotationalEnergy(aSide, aSpeed, aEnergy) - : false; - } - - public double getOutputEnergyUnitsPerTick() { - return (double) this.oOutput; - } - - public double demandedEnergyUnits() { - return !this.mReleaseEnergy && this.canAccessData() && this.mMetaTileEntity.isEnetInput() - ? (double) (this.getEUCapacity() - this.getStoredEU()) - : 0.0D; - } - - public double injectEnergyUnits(ForgeDirection aDirection, double aAmount) { - return this.injectEnergyUnits((byte) aDirection.ordinal(), (long) ((int) aAmount), 1L) > 0L ? 0.0D : aAmount; - } - - public boolean acceptsEnergyFrom(TileEntity aEmitter, ForgeDirection aDirection) { - return this.inputEnergyFrom((byte) aDirection.ordinal()); - } - - public boolean emitsEnergyTo(TileEntity aReceiver, ForgeDirection aDirection) { - return this.outputsEnergyTo((byte) aDirection.ordinal()); - } - - public double getOfferedEnergy() { - return this.canAccessData() && this.getStoredEU() - this.mMetaTileEntity.getMinimumStoredEU() >= this.oOutput - ? (double) Math.max(0L, this.oOutput) - : 0.0D; - } - - public void drawEnergy(double amount) { - this.mAverageEUOutput[this.mAverageEUOutputIndex] = (int) ((double) this.mAverageEUOutput[this.mAverageEUOutputIndex] - + amount); - this.decreaseStoredEU((long) ((int) amount), true); - } - - public int injectEnergy(ForgeDirection aForgeDirection, int aAmount) { - return this.injectEnergyUnits((byte) aForgeDirection.ordinal(), (long) aAmount, 1L) > 0L ? 0 : aAmount; - } - - public int addEnergy(int aEnergy) { - if (!this.canAccessData()) { - return 0; - } else { - if (aEnergy > 0) { - this.increaseStoredEnergyUnits((long) aEnergy, true); - } else { - this.decreaseStoredEU((long) (-aEnergy), true); - } - - return (int) Math.min(2147483647L, this.mMetaTileEntity.getEUVar()); - } - } - - public boolean isAddedToEnergyNet() { - return false; - } - - public int demandsEnergy() { - return !this.mReleaseEnergy && this.canAccessData() && this.mMetaTileEntity.isEnetInput() - ? this.getCapacity() - this.getStored() - : 0; - } - - public int getCapacity() { - return (int) Math.min(2147483647L, this.getEUCapacity()); - } - - public int getStored() { - return (int) Math.min(2147483647L, Math.min(this.getStoredEU(), (long) this.getCapacity())); - } - - public void setStored(int aEU) { - if (this.canAccessData()) { - this.setStoredEU((long) aEU); - } - - } - - public int getMaxSafeInput() { - return (int) Math.min(2147483647L, this.getInputVoltage()); - } - - public int getMaxEnergyOutput() { - return this.mReleaseEnergy ? Integer.MAX_VALUE : this.getOutput(); - } - - public int getOutput() { - return (int) Math.min(2147483647L, this.oOutput); - } - - public int injectEnergy(Direction aDirection, int aAmount) { - return this.injectEnergyUnits((byte) aDirection.toSideValue(), (long) aAmount, 1L) > 0L ? 0 : aAmount; - } - public boolean isTeleporterCompatible(Direction aSide) { return this.canAccessData() && this.mMetaTileEntity.isTeleporterCompatible(); } - public boolean acceptsEnergyFrom(TileEntity aReceiver, Direction aDirection) { - return this.inputEnergyFrom((byte) aDirection.toSideValue()); - } - - public boolean emitsEnergyTo(TileEntity aReceiver, Direction aDirection) { - return this.outputsEnergyTo((byte) aDirection.toSideValue()); - } - - public boolean isUniversalEnergyStored(long aEnergyAmount) { - if (this.getUniversalEnergyStored() >= aEnergyAmount) { - return true; - } else { - this.mHasEnoughEnergy = false; - return false; - } - } - } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java index e39c65b82f..0b8cb10606 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/BaseCustomPower_MTE.java @@ -8,50 +8,36 @@ import net.minecraftforge.common.util.ForgeDirection; public class BaseCustomPower_MTE extends BaseCustomTileEntity { - public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - //Logger.INFO("Injecting Energy Units"); - + public BaseCustomPower_MTE() { + super(); + Logger.INFO("Created new BaseCustomPower_MTE"); + } + + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { if (mMetaTileEntity == null) { - Logger.INFO("Bad Tile"); - - } - + Logger.MACHINE_INFO("Bad Tile"); + } if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.inputEnergyFrom(aSide) && aAmperage > 0L && aVoltage > 0L && this.getStoredEU() < this.getEUCapacity() - && this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes) { - Logger.INFO("Injecting Energy Units"); - if (aVoltage > this.getInputVoltage()) { - this.doExplosion(aVoltage); - return 0L; - } else if (this - .increaseStoredEnergyUnits( - aVoltage * (aAmperage = Math - .min(aAmperage, - Math.min(this.mMetaTileEntity.maxAmperesIn() - this.mAcceptedAmperes, - 1L + (this.getEUCapacity() - this.getStoredEU()) / aVoltage))), - true)) { - Logger.INFO("Injecting Energy Units"); - this.mAverageEUInput[this.mAverageEUInputIndex] = (int) ((long) this.mAverageEUInput[this.mAverageEUInputIndex] - + aVoltage * aAmperage); - this.mAcceptedAmperes += aAmperage; - return aAmperage; - } else { - return 0L; - } + && this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage()) { + Logger.MACHINE_INFO("Injecting Energy Units"); + return super.injectEnergyUnits(aSide, aVoltage, aAmperage); } else { - Logger.INFO("canAccessData(): "+canAccessData()); - Logger.INFO("isElectric(): "+this.mMetaTileEntity.isElectric()); - Logger.INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide)); - Logger.INFO("aAmperage: "+aAmperage); - Logger.INFO("aVoltage: "+aVoltage); - Logger.INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity())); - Logger.INFO("this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() > this.mAcceptedAmperes)); + Logger.MACHINE_INFO("canAccessData(): "+canAccessData()); + Logger.MACHINE_INFO("isElectric(): "+this.mMetaTileEntity.isElectric()); + Logger.MACHINE_INFO("InputEnergyFromSide("+aSide+"): "+this.inputEnergyFrom(aSide)); + Logger.MACHINE_INFO("aAmperage: "+aAmperage); + Logger.MACHINE_INFO("aVoltage: "+aVoltage); + Logger.MACHINE_INFO("this.getStoredEU() < this.getEUCapacity(): "+(this.getStoredEU() < this.getEUCapacity())); + Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn() >= this.mAcceptedAmperes: "+(this.mMetaTileEntity.maxAmperesIn() >= this.getInputAmperage())); + Logger.MACHINE_INFO("this.mMetaTileEntity.maxAmperesIn(): "+(this.mMetaTileEntity.maxAmperesIn())); + Logger.MACHINE_INFO("this.mAcceptedAmperes: "+(this.getInputAmperage())); return 0L; } } public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) { - Logger.INFO("Draining Energy Units"); + Logger.MACHINE_INFO("Draining Energy Units 4"); if (this.canAccessData() && this.mMetaTileEntity.isElectric() && this.outputsEnergyTo(aSide) && this.getStoredEU() - aVoltage * aAmperage >= this.mMetaTileEntity.getMinimumStoredEU()) { if (this.decreaseStoredEU(aVoltage * aAmperage, false)) { @@ -68,6 +54,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) { + Logger.MACHINE_INFO("Draining Energy Units 3"); // TODO Auto-generated method stub return super.decreaseStoredEnergyUnits(aEnergy, aIgnoreTooLessEnergy); } @@ -86,6 +73,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean outputsEnergyTo(byte aSide) { + Logger.MACHINE_INFO("Draining Energy Units 2"); // TODO Auto-generated method stub return super.outputsEnergyTo(aSide); } @@ -146,6 +134,7 @@ public class BaseCustomPower_MTE extends BaseCustomTileEntity { @Override public boolean decreaseStoredEU(long aEnergy, boolean aIgnoreTooLessEnergy) { + Logger.MACHINE_INFO("Draining Energy Units 1"); // TODO Auto-generated method stub return super.decreaseStoredEU(aEnergy, aIgnoreTooLessEnergy); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java index e3ab7915d2..785c4698db 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_TieredMachineBlock.java @@ -2,9 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; import static gregtech.api.enums.GT_Values.GT; -import org.apache.commons.lang3.ArrayUtils; - -import gregtech.api.enums.GT_Values; import gregtech.api.interfaces.ITexture; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.lib.CORE; @@ -67,7 +64,7 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo @Override public byte getTileEntityBaseType() { - return (byte) (Math.min(3, mTier <= 0 ? 0 : 1 + ((mTier - 1) / 4))); + return 12; } @Override @@ -85,8 +82,6 @@ public abstract class GTPP_MTE_TieredMachineBlock extends MetaTileEntityCustomPo AutoMap aTooltip = new AutoMap(); String []s1 = null; - aTooltip.put("Special GT++ Machine"); - aTooltip.put(CORE.GT_Tooltip); s1 = new String[aTooltip.size()]; int u = 0; for (String s : aTooltip) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java index 3824206d24..ba98af25f7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/MetaTileEntityCustomPower.java @@ -3,7 +3,10 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.CustomMetaTileBase; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.entity.Entity; import net.minecraft.init.Blocks; import net.minecraft.world.World; @@ -12,6 +15,7 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { public MetaTileEntityCustomPower(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { super(aID, aBasicName, aRegionalName, aInvSlotCount); + this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntityCustomPower()); } public MetaTileEntityCustomPower(String aStack, int aInvSlotCount) { @@ -23,6 +27,12 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { } public void doExplosion(long aExplosionPower) { + + if (MathUtils.randInt(1, 10) > 0) { + Logger.INFO("Machine tried to explode, let's stop that. xo"); + return; + } + float tStrength = aExplosionPower < GT_Values.V[0] ? 1.0F : (aExplosionPower < GT_Values.V[1] @@ -58,6 +68,11 @@ public abstract class MetaTileEntityCustomPower extends CustomMetaTileBase { @Override public void onExplosion() { + + if (MathUtils.randInt(1, 10) > 0) { + Logger.INFO("Machine tried to explode, let's stop that. xo"); + return; + } // TODO Auto-generated method stub super.onExplosion(); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java index 251deba6d4..e6bf4b8486 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBreaker.java @@ -55,7 +55,11 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock ITexture[][][] rTextures = new ITexture[2][17][]; for (byte i = -1; i < 16; ++i) { - rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1]}; + rTextures[0][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], + this.mInventory.length > 4 + ? BlockIcons.OVERLAYS_ENERGY_IN_MULTI[Math.min(12, mTier)] + : BlockIcons.OVERLAYS_ENERGY_IN[Math.min(12, mTier)]}; + rTextures[1][i + 1] = new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], this.mInventory.length > 4 ? BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] @@ -187,6 +191,7 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock } public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); if (aBaseMetaTileEntity.isServerSide()) { /*this.mCharge = aBaseMetaTileEntity.getStoredEU() / 2L > aBaseMetaTileEntity.getEUCapacity() / 3L; this.mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3L; @@ -268,18 +273,8 @@ public class GT_MetaTileEntity_BasicBreaker extends GTPP_MTE_TieredMachineBlock return new long[]{tStored, tScale}; } - public String[] getInfoData() { - ++this.count; - if (this.mMax == 0L || this.count % 20L == 0L) { - long[] tmp = this.getStoredEnergy(); - this.mStored = tmp[0]; - this.mMax = tmp[1]; - } - - return new String[]{this.getLocalName(), "Stored Items:", GT_Utility.formatNumbers(this.mStored) + " EU /", - GT_Utility.formatNumbers(this.mMax) + " EU", "Average input:", - this.getBaseMetaTileEntity().getAverageElectricInput() + "", "Average output:", - this.getBaseMetaTileEntity().getAverageElectricOutput() + ""}; + public String[] getInfoData() { + return new String[]{}; } public boolean isGivingInformation() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java index 57f8b722c3..01134817ae 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBattery.java @@ -51,8 +51,7 @@ GT_MetaTileEntity_Hatch { } return new String[]{ this.mDescription, - "Capacity: " + mSlots + " slots", - CORE.GT_Tooltip}; + "Capacity: " + mSlots + " slots"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java index ba97cc38eb..8cb7c943c0 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBattery.java @@ -49,8 +49,7 @@ GT_MetaTileEntity_Hatch { } return new String[]{ this.mDescription, - "Capacity: " + mSlots + " slots", - CORE.GT_Tooltip}; + "Capacity: " + mSlots + " slots"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index 9eea6b4a28..f6056af87a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -101,7 +101,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY, EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY, EnumChatFormatting.DARK_GREEN + "Gas Proof: " + (this.mGasProof) + EnumChatFormatting.GRAY, - CORE.GT_Tooltip + //CORE.GT_Tooltip }; } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java index c69ecec114..98722a2b96 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntity_Cable.java @@ -59,7 +59,7 @@ public class GregtechMetaPipeEntity_Cable extends GT_MetaPipeEntity_Cable implem "Max Voltage: %%%" + EnumChatFormatting.GREEN + mVoltage + " (" + VN[GT_Utility.getTier(mVoltage)] + ")" + EnumChatFormatting.GRAY, "Max Amperage: %%%" + EnumChatFormatting.YELLOW + mAmperage + EnumChatFormatting.GRAY, "Loss/Meter/Ampere: %%%" + EnumChatFormatting.RED + mCableLossPerMeter + EnumChatFormatting.GRAY + "%%% EU-Volt", - CORE.GT_Tooltip + //CORE.GT_Tooltip }; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java index 4a496c5002..d05a254bf7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaTreeFarmerStructural.java @@ -16,7 +16,7 @@ extends GregtechMetaTreeFarmerBase { @Override public String[] getDescription() { - return new String[] {this.mDescription, CORE.GT_Tooltip}; + return new String[] {this.mDescription}; } public GregtechMetaTreeFarmerStructural(final int aID, final String aName, final String aNameRegional, final int aTier) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java index 1920b4a282..422837fa46 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/CustomMetaTileBase.java @@ -1,18 +1,20 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import java.util.Locale; + import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.item.ItemStack; public abstract class CustomMetaTileBase extends MetaTileEntity { - private IGregTechTileEntity mBaseMetaTileEntity; public CustomMetaTileBase(int aID, String aBasicName, String aRegionalName, int aInvSlotCount) { super(aID, aBasicName, aRegionalName, aInvSlotCount); - this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity()); - this.getBaseMetaTileEntity().setMetaTileID((short) aID); + GT_LanguageManager.addStringLocalization("gtpp.blockmachines." + aBasicName.replaceAll(" ", "_").toLowerCase(Locale.ENGLISH) + ".name", aRegionalName); + this.setBaseMetaTileEntity(Meta_GT_Proxy.constructBaseMetaTileEntity()); + this.getBaseMetaTileEntity().setMetaTileID((short) aID); } public CustomMetaTileBase(String aName, int aInvSlotCount) { @@ -24,7 +26,35 @@ public abstract class CustomMetaTileBase extends MetaTileEntity { } public String getLocalName() { - return GT_LanguageManager.getTranslation("gt.blockmachines." + this.mName + ".name"); + return GT_LanguageManager.getTranslation("gtpp.blockmachines." + this.mName + ".name"); + } + + /** + * This determines the BaseMetaTileEntity belonging to this MetaTileEntity by using the Meta ID of the Block itself. + *

+ * 0 = BaseMetaTileEntity, Wrench lvl 0 to dismantlee + * 1 = BaseMetaTileEntity, Wrench lvl 1 to dismantle + * 2 = BaseMetaTileEntity, Wrench lvl 2 to dismantle + * 3 = BaseMetaTileEntity, Wrench lvl 3 to dismantle + * 4 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle + * 5 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle + * 6 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle + * 7 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle + * 8 = BaseMetaPipeEntity, Cutter lvl 0 to dismantle + * 9 = BaseMetaPipeEntity, Cutter lvl 1 to dismantle + * 10 = BaseMetaPipeEntity, Cutter lvl 2 to dismantle + * 11 = BaseMetaPipeEntity, Cutter lvl 3 to dismantle + * + * == Reserved for Alk now + * + * 12 = BaseMetaPipeEntity, Wrench lvl 0 to dismantle + * 13 = BaseMetaPipeEntity, Wrench lvl 1 to dismantle + * 14 = BaseMetaPipeEntity, Wrench lvl 2 to dismantle + * 15 = BaseMetaPipeEntity, Wrench lvl 3 to dismantle + */ + @Override + public byte getTileEntityBaseType() { + return 12; } } \ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java index 4140617fcf..c9201471a4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTileEntity.java @@ -63,7 +63,7 @@ public abstract class GregtechMetaTileEntity extends MetaTileEntity { @Override public String[] getDescription() { - return new String[] { this.mDescription, CORE.GT_Tooltip }; + return new String[] { this.mDescription }; } /** diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java index df7e8cf373..ccf31673e7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMetaTransformerHiAmp.java @@ -85,7 +85,7 @@ public class GregtechMetaTransformerHiAmp extends GT_MetaTileEntity_Transformer @Override public String[] getDescription() { - return new String[] { this.mDescription, "Accepts 4A and outputs 16A", CORE.GT_Tooltip }; + return new String[] { this.mDescription, "Accepts 4A and outputs 16A"}; } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 3e5c783a5c..41ba313b0e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -295,15 +295,13 @@ GT_MetaTileEntity_MultiBlockBase { aRequiresCoreModule, aRequiresMuffler, getPollutionTooltip(), - getMachineTooltip(), - CORE.GT_Tooltip}; + getMachineTooltip()}; } else { z = new String[] { aRequiresMaint, aRequiresCoreModule, - getMachineTooltip(), - CORE.GT_Tooltip}; + getMachineTooltip(),}; } int a2, a3; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java index f6dc8547cc..287d2105ac 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechDoubleFuelGeneratorBase.java @@ -58,7 +58,7 @@ public abstract class GregtechDoubleFuelGeneratorBase extends GT_MetaTileEntity_ @Override public String[] getDescription() { - return new String[]{this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%", CORE.GT_Tooltip}; + return new String[]{this.mDescription, "Fuel Efficiency: " + this.getEfficiency() + "%"}; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java index c1915fb14a..a88d6a4832 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/generators/GregtechRocketFuelGeneratorBase.java @@ -65,13 +65,11 @@ public abstract class GregtechRocketFuelGeneratorBase extends GT_MetaTileEntity_ return new String[]{ this.mDescription, "Fuel Efficiency: " + this.getEfficiency()*2 + "%", - aPollution, - CORE.GT_Tooltip}; + aPollution}; } return new String[]{ this.mDescription, - "Fuel Efficiency: " + this.getEfficiency()*2 + "%", - CORE.GT_Tooltip}; + "Fuel Efficiency: " + this.getEfficiency()*2 + "%"}; } -- cgit