aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/common
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2017-06-14 22:53:29 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2017-06-14 22:53:29 +1000
commitdd1cc776226c2022b5a0d795c5bb5b02cede987a (patch)
tree1f630ac700f7c02c96075beac49431d06cde1f70 /src/Java/gtPlusPlus/xmod/gregtech/common
parente3c633b3e962afac90f8f5b79e2210d8ed566108 (diff)
downloadGT5-Unofficial-dd1cc776226c2022b5a0d795c5bb5b02cede987a.tar.gz
GT5-Unofficial-dd1cc776226c2022b5a0d795c5bb5b02cede987a.tar.bz2
GT5-Unofficial-dd1cc776226c2022b5a0d795c5bb5b02cede987a.zip
+ Added a Pollution Detector.
- Disabled some unused Gregtech Tile Entities. % Refactored some classes to be in better locations.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java264
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java172
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java375
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java414
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java58
5 files changed, 1283 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
new file mode 100644
index 0000000000..7e2bcdd4f4
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -0,0 +1,264 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.generators.creative;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.*;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GregtechMetaEnergyBuffer;
+import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+
+/**
+ * NEVER INCLUDE THIS FILE IN YOUR MOD!!!
+ *
+ * This is the main construct for my Basic Machines such as the Automatic Extractor
+ * Extend this class to make a simple Machine
+ */
+public class GregtechMetaCreativeEnergyBuffer extends GregtechMetaEnergyBuffer {
+
+
+ public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier,
+ final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aDescription, aTextures, aSlotCount);
+ // TODO Auto-generated constructor stub
+ }
+
+ public GregtechMetaCreativeEnergyBuffer(final int aID, final String aName,
+ final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"};
+ }
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[2][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT),
+ this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier] };
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity,
+ final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive,
+ final boolean aRedstone) {
+ return this.mTextures[aSide == aFacing ? 1 : 0][aColorIndex + 1];
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription,
+ this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+
+ @Override
+ public long getMinimumStoredEU() {
+ return 1;
+ }
+
+ @Override
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
+ }
+
+ @Override
+ public long maxEUInput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return this.mChargeableCount * 16;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return this.mChargeableCount * 16;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return this.mCharge?this.mInventory.length:0;}
+ @Override public int dechargerSlotCount() {return this.mDecharge?this.mInventory.length:0;}
+ @Override public int getProgresstime() {return Integer.MAX_VALUE;}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (this.mInventory.length) {
+ case 1: return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ case 4: return new GT_Container_2by2(aPlayerInventory, aBaseMetaTileEntity);
+ case 9: return new GT_Container_3by3(aPlayerInventory, aBaseMetaTileEntity);
+ case 16: return new GT_Container_4by4(aPlayerInventory, aBaseMetaTileEntity);
+ }
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory,
+ final IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (this.mInventory.length) {
+ case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ this.mCharge = (aBaseMetaTileEntity.getStoredEU() / 2) > (aBaseMetaTileEntity
+ .getEUCapacity() / 3);
+ this.mDecharge = aBaseMetaTileEntity.getStoredEU() < (aBaseMetaTileEntity.getEUCapacity() / 3);
+ this.mBatteryCount = 1;
+ this.mChargeableCount = 1;
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(this.mMax, true);
+ for (final ItemStack tStack : this.mInventory) {
+ if (GT_ModHandler.isElectricItem(tStack, this.mTier)) {
+ if (GT_ModHandler.isChargerItem(tStack)) {
+ this.mBatteryCount++;
+ }
+ this.mChargeableCount++;
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){
+ final String name = aStack.getUnlocalizedName();
+ if(name.equals("gt.metaitem.01.32510")||
+ name.equals("gt.metaitem.01.32511")||
+ name.equals("gt.metaitem.01.32520")||
+ name.equals("gt.metaitem.01.32521")||
+ name.equals("gt.metaitem.01.32530")||
+ name.equals("gt.metaitem.01.32531")){
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ if(!GT_Utility.isStackValid(aStack)){
+ return false;
+ }
+ if(GT_ModHandler.isElectricItem(aStack, this.mTier)){
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public long[] getStoredEnergy(){
+ long tScale = this.getBaseMetaTileEntity().getEUCapacity();
+ long tStored = this.getBaseMetaTileEntity().getStoredEU();
+ this.setEUVar(Long.MAX_VALUE);
+ if (this.mInventory != null) {
+ for (final ItemStack aStack : this.mInventory) {
+ if (GT_ModHandler.isElectricItem(aStack)) {
+
+ if (aStack.getItem() instanceof GT_MetaBase_Item) {
+ final Long[] stats = ((GT_MetaBase_Item) aStack.getItem())
+ .getElectricStats(aStack);
+ if (stats != null) {
+ tScale = tScale + stats[0];
+ tStored = tStored
+ + ((GT_MetaBase_Item) aStack.getItem())
+ .getRealCharge(aStack);
+ }
+ } else if (aStack.getItem() instanceof IElectricItem) {
+ tStored = tStored
+ + (long) ic2.api.item.ElectricItem.manager
+ .getCharge(aStack);
+ tScale = tScale
+ + (long) ((IElectricItem) aStack.getItem())
+ .getMaxCharge(aStack);
+ }
+ }
+ }
+
+ }
+ return new long[] { tStored, tScale };
+ }
+
+ private long count=0;
+ private long mStored=0;
+ private long mMax=0;
+
+ @Override
+ public String[] getInfoData() {
+ this.count++;
+ if((this.mMax==0)||((this.count%20)==0)){
+ final long[] tmp = this.getStoredEnergy();
+ this.mStored=tmp[0];
+ this.mMax=tmp[1];
+ }
+
+ return new String[] {
+ this.getLocalName(),
+ "THIS IS A CREATIVE ITEM - FOR TESTING",
+ GT_Utility.formatNumbers(this.mStored)+" EU /",
+ GT_Utility.formatNumbers(this.mMax)+" EU"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java
new file mode 100644
index 0000000000..fa013f49ab
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaCondensor.java
@@ -0,0 +1,172 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SteamCondenser;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SteamCondenser;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.generators.GregtechMetaBoilerBase;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.IFluidHandler;
+
+public class GregtechMetaCondensor extends GregtechMetaBoilerBase{
+
+ public GregtechMetaCondensor(final int aID, final String aName, final String aNameRegional)
+ {
+ super(aID, aName, aNameRegional, "A Steam condenser - [IC2->Steam]", new ITexture[0]);
+ }
+
+ public GregtechMetaCondensor(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures)
+ {
+ super(aName, aTier, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures)
+ {
+ final ITexture[][][] rTextures = new ITexture[5][17][];
+ for (byte i = -1; i < 16; i++){
+ rTextures[0][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa))};
+ rTextures[1][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) };
+ rTextures[2][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) };
+ rTextures[3][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER) };
+ rTextures[4][(i + 1)] = new ITexture [] { new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_VENT, Dyes.getModulation(i, Dyes.MACHINE_METAL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE) };
+ }
+ return rTextures;
+ }
+
+ @Override
+ public int maxProgresstime()
+ {
+ return 1000;
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new CONTAINER_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, 32000);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity)
+ {
+ return new GUI_SteamCondenser(aPlayerInventory, aBaseMetaTileEntity, "SteelBoiler.png", 32000);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity)
+ {
+ return new GregtechMetaCondensor(this.mName, this.mTier, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick)
+ {
+ this.RI = MathUtils.randLong(5L, 30L);
+ if ((aBaseMetaTileEntity.isServerSide()) && (aTick > 20L))
+ {
+ if (this.mTemperature <= 5)
+ {
+ this.mTemperature = 5;
+ this.mLossTimer = 0;
+ }
+ if (++this.mLossTimer > 10)
+ {
+ this.mTemperature -= 1;
+ this.mLossTimer = 0;
+ }
+ for (byte i = 1; (this.mSteam != null) && (i < 6); i = (byte)(i + 1)) {
+ if (i != aBaseMetaTileEntity.getFrontFacing())
+ {
+ final IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(i);
+ if (tTileEntity != null)
+ {
+ final FluidStack tDrained = aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), Math.max(1, this.mSteam.amount / 2), false);
+ if (tDrained != null)
+ {
+ final int tFilledAmount = tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), tDrained, false);
+ if (tFilledAmount > 0) {
+ tTileEntity.fill(ForgeDirection.getOrientation(i).getOpposite(), aBaseMetaTileEntity.drain(ForgeDirection.getOrientation(i), tFilledAmount, true), true);
+ }
+ }
+ }
+ }
+ }
+ if ((aTick % 10L) == 0L) {
+ if (this.mTemperature > 5)
+ {
+ if ((this.mFluid == null) || (!GT_ModHandler.isWater(this.mFluid)) || (this.mFluid.amount <= 0))
+ {
+ this.mHadNoWater = true;
+ }
+ else
+ {
+ if (this.mHadNoWater)
+ {
+ aBaseMetaTileEntity.doExplosion(2048L);
+ return;
+ }
+ this.mFluid.amount -= 1;
+ if (this.mSteam == null) {
+ this.mSteam = GT_ModHandler.getSteam(30L);
+ } else if (GT_ModHandler.isSteam(this.mSteam)) {
+ this.mSteam.amount += 30;
+ } else {
+ this.mSteam = GT_ModHandler.getSteam(30L);
+ }
+ }
+ }
+ else {
+ this.mHadNoWater = false;
+ }
+ }
+ if ((this.mSteam != null) &&
+ (this.mSteam.amount > 32000))
+ {
+ this.sendSound((byte)1);
+ this.mSteam.amount = 24000;
+ }
+ /*if ((this.mProcessingEnergy <= 0) && (aBaseMetaTileEntity.isAllowedToWork()) &&
+ (GT_OreDictUnificator.isItemStackInstanceOf(this.mInventory[2], OrePrefixes.bucket.get(IC2.getItemFromBlock(p_150898_0_)))))
+ {
+ this.mProcessingEnergy += 1000;
+ aBaseMetaTileEntity.decrStackSize(2, 1);
+ aBaseMetaTileEntity.addStackToSlot(3, GT_OreDictUnificator.get(OrePrefixes.bucket, Materials.Empty, 1L));
+ }*/
+ if ((this.mTemperature < 1000) && (this.mProcessingEnergy > 0) && ((aTick % this.RI) == 0L))
+ {
+ this.mProcessingEnergy -= 40;
+ this.mTemperature += 2;
+ }
+ aBaseMetaTileEntity.setActive(this.mProcessingEnergy > 0);
+ }
+ }
+
+ @Override
+ public final int fill(final FluidStack aFluid, final boolean doFill)
+ {
+ if ((Utils.isIC2Steam(aFluid)) && (this.mProcessingEnergy < 50))
+ {
+ final int tFilledAmount = Math.min(50, aFluid.amount);
+ if (doFill) {
+ this.mProcessingEnergy += tFilledAmount;
+ }
+ return tFilledAmount;
+ }
+ return super.fill(aFluid, doFill);
+ }
+}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
new file mode 100644
index 0000000000..a9f1c68bc4
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaPollutionDetector.java
@@ -0,0 +1,375 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.GT_Mod;
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Pollution;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.player.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GregtechMetaPollutionDetector extends GregtechMetaTileEntity {
+
+ int mCurrentPollution;
+ int mAveragePollution;
+ int mAveragePollutionArray[] = new int[10];
+ private int mArrayPos = 0;
+ private int mTickTimer = 0;
+ private int mSecondTimer = 0;
+
+ public GregtechMetaPollutionDetector(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaPollutionDetector(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, CORE.GT_Tooltip};
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaPollutionDetector(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return false;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return V[this.mTier]*1;}
+ @Override public long maxEUStore() {return V[this.mTier]*1000;}
+
+ @Override
+ public long maxEUInput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return 0;
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return 1;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return 0;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return 0;}
+ @Override public int dechargerSlotCount() {return 0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ }
+ this.showPollution(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showPollution(final World worldIn, final EntityPlayer playerIn){
+ if(!GT_Mod.gregtechproxy.mPollution){
+ PlayerUtils.messagePlayer(playerIn, "This block is useless, Pollution is disabled.");
+ }
+ else {
+ PlayerUtils.messagePlayer(playerIn, "This chunk contains "+getCurrentChunkPollution()+" pollution.");
+ PlayerUtils.messagePlayer(playerIn, "Average over last ten minutes: "+this.mAveragePollution+" pollution.");
+ }
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ public int getCurrentChunkPollution(){
+ return getCurrentChunkPollution(this.getBaseMetaTileEntity());
+ }
+
+ public int getCurrentChunkPollution(IGregTechTileEntity aBaseMetaTileEntity){
+ return GT_Pollution.getPollution(aBaseMetaTileEntity);
+ }
+
+
+ @Override
+ public String[] getInfoData() {
+ return new String[] {
+ this.getLocalName(),
+ "Current Pollution: "+this.mCurrentPollution,
+ "Average/10 minutes:"+getAveragePollutionOverLastTen()};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return null;
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+ @Override
+ public boolean isOverclockerUpgradable() {
+ return false;
+ }
+
+ @Override
+ public boolean isTransformerUpgradable() {
+ return false;
+ }
+
+ //int mCurrentPollution;
+ //int mAveragePollution;
+ //int mAveragePollutionArray[] = new int[10];
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setInteger("mCurrentPollution", this.mCurrentPollution);
+ aNBT.setInteger("mAveragePollution", this.mAveragePollution);
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mCurrentPollution = aNBT.getInteger("mCurrentPollution");
+ this.mAveragePollution = aNBT.getInteger("mAveragePollution");
+ }
+
+ @Override
+ public void onFirstTick(final IGregTechTileEntity aBaseMetaTileEntity) {
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ if (this.mCurrentPollution == 0) {
+ this.mCurrentPollution = getCurrentChunkPollution();
+ }
+ if (this.mArrayPos < 0 || this.mArrayPos > 9) {
+ this.mArrayPos = 0;
+ }
+ this.mTickTimer = 0;
+ }
+ }
+
+
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (this.getBaseMetaTileEntity().isServerSide()) {
+ //TickTimer - 20 times a second
+ if (this.mTickTimer >= 0 || this.mTickTimer <= 19){
+ this.mTickTimer++;
+ }
+ else {
+ this.mTickTimer = 0;
+ //Perform pollution update once a second
+ this.mCurrentPollution = getCurrentChunkPollution();
+ this.mSecondTimer++;
+ }
+ //Update Pollution array once a minute
+ if (this.mSecondTimer >= 60){
+ this.mSecondTimer = 0;
+ if (this.mArrayPos<this.mAveragePollutionArray.length){
+ this.mAveragePollutionArray[this.mArrayPos] = this.mCurrentPollution;
+ this.mArrayPos++;
+ }
+ else if (this.mArrayPos==this.mAveragePollutionArray.length){
+ this.mAveragePollutionArray[this.mArrayPos] = this.mCurrentPollution;
+ this.mArrayPos = 0;
+ }
+ }
+ }
+ }
+
+ public int getAveragePollutionOverLastTen(){
+ int counter = 0;
+ int total = 0;
+ for (int i=0;i<this.mAveragePollutionArray.length;i++){
+ if (this.mAveragePollutionArray[i] != 0){
+ total += this.mAveragePollutionArray[i];
+ counter++;
+ }
+ }
+ int returnValue = 0;
+ if (total > 0 && counter > 0){
+ returnValue = (total/counter);
+ this.mAveragePollution = returnValue;
+ }
+ else {
+ returnValue = getCurrentChunkPollution();
+ }
+ return returnValue;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
new file mode 100644
index 0000000000..a5fbca4a64
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java
@@ -0,0 +1,414 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import static gregtech.api.enums.GT_Values.V;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.items.GT_MetaBase_Item;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_ModHandler;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.player.PlayerUtils;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
+import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
+import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.world.World;
+
+public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity {
+
+ /*
+ * public GregtechMetaEnergyBuffer() { super.this
+ * setCreativeTab(GregTech_API.TAB_GREGTECH); }
+ */
+
+ public boolean mCharge = false, mDecharge = false;
+ public int mBatteryCount = 1, mChargeableCount = 1;
+
+ public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
+ }
+
+ public GregtechMetaEnergyBuffer(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures, final int aSlotCount) {
+ super(aName, aTier, aSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, CORE.GT_Tooltip};
+ }
+
+ /*
+ * MACHINE_STEEL_SIDE
+ */
+
+ @Override
+ public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
+ final ITexture[][][] rTextures = new ITexture[10][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+ return rTextures;
+ }
+
+ @Override
+ public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, final byte aColorIndex, final boolean aActive, final boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + 1];
+ }
+
+
+ public ITexture[] getFront(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBack(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottom(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTop(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSides(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getFrontActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier]};
+ }
+
+
+ public ITexture[] getBackActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getBottomActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+
+ public ITexture[] getTopActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Screen_Logo)};
+ }
+
+
+ public ITexture[] getSidesActive(final byte aColor) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1], new GT_RenderedTexture(TexturesGtBlock.Overlay_Machine_Dimensional_Orange)};
+ }
+
+ /*@Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[2][17][];
+ for (byte i = -1; i < 16; i++) {
+ rTextures[0][i + 1] = new ITexture[] { new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_HEATPROOFCASING) };
+ rTextures[1][i + 1] = new ITexture[] {
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_HEATPROOFCASING),
+ mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
+ }
+ return rTextures;
+ }*/
+
+ /*
+ * @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ * ITexture[][][] rTextures = new ITexture[5][17][]; for (byte i = -1; i <
+ * 16; i = (byte) (i + 1)) { ITexture[] tmp0 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)) }; rTextures[0][(i + 1)] = tmp0; ITexture[] tmp1 = {
+ * new GT_RenderedTexture( Textures.BlockIcons.MACHINE_STEEL_TOP) };
+ * rTextures[1][(i + 1)] = tmp1; ITexture[] tmp2 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE) }; rTextures[2][(i +
+ * 1)] = tmp2; ITexture[] tmp4 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new
+ * GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT) }; rTextures[3][(i +
+ * 1)] = tmp4; ITexture[] tmp5 = { new GT_RenderedTexture(
+ * Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i,
+ * Dyes._NULL.mRGBa)), new GT_RenderedTexture(
+ * Textures.BlockIcons.BOILER_FRONT_ACTIVE) }; rTextures[4][(i + 1)] = tmp5;
+ * } return rTextures; }
+ */
+
+ /*@Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ return mTextures[aSide == aFacing ? 1 : 0][aColorIndex+1];
+ }*/
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures, this.mInventory.length);
+ }
+
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(final int aIndex) {return true;}
+ @Override public boolean isFacingValid(final byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(final byte aSide) {return aSide!=this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(final byte aSide) {return aSide==this.getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
+ @Override public long getMinimumStoredEU() {return V[this.mTier]*2;}
+ @Override public long maxEUStore() {return V[this.mTier]*250000;}
+
+ @Override
+ public long maxEUInput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxEUOutput() {
+ return V[this.mTier];
+ }
+
+ @Override
+ public long maxAmperesIn() {
+ return this.mChargeableCount * 4;
+ }
+
+ @Override
+ public long maxAmperesOut() {
+ return this.mChargeableCount * 4;
+ }
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return this.mCharge?this.mInventory.length:0;}
+ @Override public int dechargerSlotCount() {return this.mDecharge?this.mInventory.length:0;}
+ @Override public int getProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyStored();}
+ @Override public int maxProgresstime() {return (int)this.getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;}
+
+ @Override
+ public void saveNBTData(final NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public void loadNBTData(final NBTTagCompound aNBT) {
+ //
+ }
+
+ @Override
+ public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) {
+ Utils.LOG_WARNING("Right Click on MTE by Player");
+ if (aBaseMetaTileEntity.isClientSide())
+ {
+ return true;
+ //aBaseMetaTileEntity.openGUI(aPlayer);
+ }
+
+ Utils.LOG_WARNING("MTE is Client-side");
+ this.showEnergy(aPlayer.getEntityWorld(), aPlayer);
+ return true;
+ }
+
+ private void showEnergy(final World worldIn, final EntityPlayer playerIn){
+ final long tempStorage = this.getStoredEnergy()[0];
+ final double c = ((double) tempStorage / this.maxEUStore()) * 100;
+ final double roundOff = Math.round(c * 100.00) / 100.00;
+ PlayerUtils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[this.mTier]+"v ("+roundOff+"%)");
+
+ }
+ //Utils.LOG_WARNING("Begin Show Energy");
+ /*
+ *
+ //Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" C: "+c);
+ Utils.LOG_INFO("getProgressTime: "+getProgresstime());
+ Utils.LOG_INFO("maxProgressTime: "+maxProgresstime());
+ Utils.LOG_INFO("getMinimumStoredEU: "+getMinimumStoredEU());
+ Utils.LOG_INFO("maxEUStore: "+maxEUStore());*/
+ /*final long d = (tempStorage * 100L) / maxEUStore();
+ Utils.LOG_INFO("getProgresstime: "+tempStorage+" maxProgresstime: "+maxEUStore()+" D: "+d);
+ final double roundOff2 = Math.round(d * 100.00) / 100.00;
+ Utils.messagePlayer(playerIn, "Energy: " + tempStorage + " EU at "+V[mTier]+"v ("+roundOff2+"%)");
+ Utils.LOG_WARNING("Making new instance of Guihandler");
+ GuiHandler block = new GuiHandler();
+ Utils.LOG_WARNING("Guihandler.toString(): "+block.toString());
+ block.getClientGuiElement(1, playerIn, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ);*/
+
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_1by1(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName());
+ }
+
+ @Override
+ public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
+
+ }
+
+ @Override
+ public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, final ItemStack aStack) {
+ return false;
+ }
+
+ public long[] getStoredEnergy(){
+ long tScale = this.getBaseMetaTileEntity().getEUCapacity();
+ long tStored = this.getBaseMetaTileEntity().getStoredEU();
+ if (this.mInventory != null) {
+ for (final ItemStack aStack : this.mInventory) {
+ if (GT_ModHandler.isElectricItem(aStack)) {
+
+ if (aStack.getItem() instanceof GT_MetaBase_Item) {
+ final Long[] stats = ((GT_MetaBase_Item) aStack.getItem())
+ .getElectricStats(aStack);
+ if (stats != null) {
+ tScale = tScale + stats[0];
+ tStored = tStored
+ + ((GT_MetaBase_Item) aStack.getItem())
+ .getRealCharge(aStack);
+ }
+ } else if (aStack.getItem() instanceof IElectricItem) {
+ tStored = tStored
+ + (long) ic2.api.item.ElectricItem.manager
+ .getCharge(aStack);
+ tScale = tScale
+ + (long) ((IElectricItem) aStack.getItem())
+ .getMaxCharge(aStack);
+ }
+ }
+ }
+
+ }
+ return new long[] { tStored, tScale };
+ }
+
+ private long count=0;
+ private long mStored=0;
+ private long mMax=0;
+
+ @Override
+ public String[] getInfoData() {
+ this.count++;
+ if((this.mMax==0)||((this.count%20)==0)){
+ final long[] tmp = this.getStoredEnergy();
+ this.mStored=tmp[0];
+ this.mMax=tmp[1];
+ }
+
+ return new String[] {
+ this.getLocalName(),
+ GT_Utility.formatNumbers(this.mStored)+" EU /",
+ GT_Utility.formatNumbers(this.mMax)+" EU"};
+ }
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public int[] getAccessibleSlotsFromSide(final int p_94128_1_) {
+ return null;
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return false;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return false;
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return 0;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int p_70301_1_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int p_70298_1_, final int p_70298_2_) {
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int p_70304_1_) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int p_70299_1_, final ItemStack p_70299_2_) {
+ }
+
+ @Override
+ public String getInventoryName() {
+ return null;
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 0;
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer p_70300_1_) {
+ return false;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) {
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java
new file mode 100644
index 0000000000..f2f6a3e164
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaSafeBlock.java
@@ -0,0 +1,58 @@
+package gtPlusPlus.xmod.gregtech.common.tileentities.storage;
+
+import gregtech.api.enums.Textures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.objects.GT_RenderedTexture;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_SafeBlock;
+import gtPlusPlus.xmod.gregtech.api.gui.GUI_SafeBlock;
+import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.machines.GregtechMetaSafeBlockBase;
+import net.minecraft.entity.player.InventoryPlayer;
+
+public class GregtechMetaSafeBlock
+extends GregtechMetaSafeBlockBase {
+
+ @Override
+ public String[] getDescription() {
+ return new String[] {this.mDescription, CORE.GT_Tooltip};
+ }
+
+ public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier) {
+ super(aID, aName, aNameRegional, aTier, 28, "Protecting your items from sticky fingers.");
+ }
+
+ public GregtechMetaSafeBlock(final int aID, final String aName, final String aNameRegional, final int aTier, final int aInvSlotCount, final String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
+ }
+
+ public GregtechMetaSafeBlock(final String aName, final int aTier, final int aInvSlotCount, final String aDescription, final ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaSafeBlock(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ @Override
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.VOID);
+ }
+
+ @Override
+ public boolean isValidSlot(final int aIndex) {
+ return aIndex < (this.mInventory.length - 1);
+ }
+
+ @Override
+ public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_SafeBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GUI_SafeBlock(aPlayerInventory, aBaseMetaTileEntity);
+ }
+}