aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-11-06 19:32:27 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-11-06 19:32:27 +1000
commitcbe0e497be8e466c380a5b4fa781b314ede9ada3 (patch)
treeb85848b432adf458e3abda466ee46d9dfc3e454b /src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative
parentc40416b036c0e89451e1558253ccf07bbee028d0 (diff)
downloadGT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.gz
GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.tar.bz2
GT5-Unofficial-cbe0e497be8e466c380a5b4fa781b314ede9ada3.zip
Revert "$ Cleaned up the entire project."
This reverts commit 0669f5eb9d5029a8b94ec552171b0837605f7747. # Conflicts: # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMTE_NuclearReactor.java # src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntity_MassFabricator.java Revert "% Cleaned up Imports." This reverts commit 3654052fb63a571c5eaca7f20714b87c17f7e966.
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java388
1 files changed, 163 insertions, 225 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java
index a00d41717f..348e7dd118 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/creative/GregtechMetaCreativeEnergyBuffer.java
@@ -1,8 +1,15 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.creative;
-import gregtech.api.enums.GT_Values;
+import static gregtech.api.enums.GT_Values.V;
import gregtech.api.enums.Textures;
-import gregtech.api.gui.*;
+import gregtech.api.gui.GT_Container_1by1;
+import gregtech.api.gui.GT_Container_2by2;
+import gregtech.api.gui.GT_Container_3by3;
+import gregtech.api.gui.GT_Container_4by4;
+import gregtech.api.gui.GT_GUIContainer_1by1;
+import gregtech.api.gui.GT_GUIContainer_2by2;
+import gregtech.api.gui.GT_GUIContainer_3by3;
+import gregtech.api.gui.GT_GUIContainer_4by4;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -20,312 +27,243 @@ 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
+ *
+ * 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 boolean mCharge = false, mDecharge = false;
- public int mBatteryCount = 1, mChargeableCount = 1;
-
- private long count = 0;
- private long mStored = 0;
-
- private long mMax = 0;
-
- 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);
- }
-
- public GregtechMetaCreativeEnergyBuffer(final String aName, final int aTier, final String aDescription,
- final ITexture[][][] aTextures, final int aSlotCount) {
+ public GregtechMetaCreativeEnergyBuffer(String aName, int aTier,
+ String aDescription, ITexture[][][] aTextures, int aSlotCount) {
super(aName, aTier, aDescription, aTextures, aSlotCount);
// TODO Auto-generated constructor stub
}
- @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;
+ public GregtechMetaCreativeEnergyBuffer(int aID, String aName,
+ String aNameRegional, int aTier, String aDescription, int aSlotCount) {
+ super(aID, aName, aNameRegional, aTier, aDescription, aSlotCount);
}
- @Override
- public int dechargerSlotCount() {
- return this.mDecharge ? this.mInventory.length : 0;
- }
-
- @Override
- public int dechargerSlotStartIndex() {
- return 0;
- }
-
- @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());
- }
+ public boolean mCharge = false, mDecharge = false;
+ public int mBatteryCount = 1, mChargeableCount = 1;
@Override
public String[] getDescription() {
- return new String[] {
- this.mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN + "Alkalus"
- };
- }
-
- @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 long getMinimumStoredEU() {
- return 1;
- }
-
- @Override
- public int getProgresstime() {
- return Integer.MAX_VALUE;
- }
-
- @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 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
- };
- }
-
- @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];
+ return new String[] {mDescription, "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus"};
}
/*
* MACHINE_STEEL_SIDE
*/
@Override
- public ITexture[][][] getTextureSet(final ITexture[] aTextures) {
- final ITexture[][][] rTextures = new ITexture[2][17][];
+ 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_CASING_MAGIC_FRONT)
- };
+ 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]
- };
+ new GT_RenderedTexture(
+ Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT),
+ mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier]
+ : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier] };
}
return rTextures;
}
@Override
- public boolean isAccessAllowed(final EntityPlayer aPlayer) {
- return true;
+ 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 boolean isElectric() {
- return true;
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GregtechMetaCreativeEnergyBuffer(mName, mTier, mDescription,
+ mTextures, mInventory.length);
}
- @Override
- public boolean isEnetInput() {
- return true;
- }
-
- @Override
- public boolean isEnetOutput() {
- return true;
- }
+ @Override public boolean isSimpleMachine() {return false;}
+ @Override public boolean isElectric() {return true;}
+ @Override public boolean isValidSlot(int aIndex) {return true;}
+ @Override public boolean isFacingValid(byte aFacing) {return true;}
+ @Override public boolean isEnetInput() {return true;}
+ @Override public boolean isEnetOutput() {return true;}
+ @Override public boolean isInputFacing(byte aSide) {return aSide!=getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isOutputFacing(byte aSide) {return aSide==getBaseMetaTileEntity().getFrontFacing();}
+ @Override public boolean isTeleporterCompatible() {return false;}
@Override
- public boolean isFacingValid(final byte aFacing) {
- return true;
+ public long getMinimumStoredEU() {
+ return 1;
}
@Override
- public boolean isGivingInformation() {
- return true;
+ public long maxEUStore() {
+ return Long.MAX_VALUE;
}
@Override
- public boolean isInputFacing(final byte aSide) {
- return aSide != this.getBaseMetaTileEntity().getFrontFacing();
+ public long maxEUInput() {
+ return V[mTier];
}
@Override
- public boolean isOutputFacing(final byte aSide) {
- return aSide == this.getBaseMetaTileEntity().getFrontFacing();
+ public long maxEUOutput() {
+ return V[mTier];
}
@Override
- public boolean isSimpleMachine() {
- return false;
+ public long maxAmperesIn() {
+ return mChargeableCount * 16;
}
@Override
- public boolean isTeleporterCompatible() {
- return false;
+ public long maxAmperesOut() {
+ return mChargeableCount * 16;
}
+ @Override public int rechargerSlotStartIndex() {return 0;}
+ @Override public int dechargerSlotStartIndex() {return 0;}
+ @Override public int rechargerSlotCount() {return mCharge?mInventory.length:0;}
+ @Override public int dechargerSlotCount() {return mDecharge?mInventory.length:0;}
+ @Override public int getProgresstime() {return Integer.MAX_VALUE;}
+ @Override public int maxProgresstime() {return (int)getBaseMetaTileEntity().getUniversalEnergyCapacity();}
+ @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;}
@Override
- public boolean isValidSlot(final int aIndex) {
- return true;
+ public void saveNBTData(NBTTagCompound aNBT) {
+ //
}
@Override
- public void loadNBTData(final NBTTagCompound aNBT) {
+ public void loadNBTData(NBTTagCompound aNBT) {
//
}
@Override
- public long maxAmperesIn() {
- return this.mChargeableCount * 16;
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (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 long maxAmperesOut() {
- return this.mChargeableCount * 16;
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory,
+ IGregTechTileEntity aBaseMetaTileEntity) {
+ switch (mInventory.length) {
+ case 1: return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 4: return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 9: return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ case 16: return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ }
+ return new GT_GUIContainer_1by1(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
}
@Override
- public long maxEUInput() {
- return GT_Values.V[this.mTier];
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(Integer.MAX_VALUE, true);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ mCharge = aBaseMetaTileEntity.getStoredEU() / 2 > aBaseMetaTileEntity
+ .getEUCapacity() / 3;
+ mDecharge = aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity() / 3;
+ mBatteryCount = 1;
+ mChargeableCount = 1;
+ this.getBaseMetaTileEntity().increaseStoredEnergyUnits(mMax, true);
+ for (ItemStack tStack : mInventory) if (GT_ModHandler.isElectricItem(tStack, mTier)) {
+ if (GT_ModHandler.isChargerItem(tStack)) mBatteryCount++;
+ mChargeableCount++;
+ }
+ }
}
@Override
- public long maxEUOutput() {
- return GT_Values.V[this.mTier];
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(GT_ModHandler.isElectricItem(aStack)&&aStack.getUnlocalizedName().startsWith("gt.metaitem.01.")){
+ 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 long maxEUStore() {
- return Long.MAX_VALUE;
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if(!GT_Utility.isStackValid(aStack)){
+ return false;
+ }
+ if(GT_ModHandler.isElectricItem(aStack, this.mTier)){
+ return true;
+ }
+ return false;
}
@Override
- public int maxProgresstime() {
- return (int) this.getBaseMetaTileEntity().getUniversalEnergyCapacity();
- }
+ public long[] getStoredEnergy(){
+ long tScale = getBaseMetaTileEntity().getEUCapacity();
+ long tStored = getBaseMetaTileEntity().getStoredEU();
+ this.setEUVar(Long.MAX_VALUE);
+ if (mInventory != null) {
+ for (ItemStack aStack : mInventory) {
+ if (GT_ModHandler.isElectricItem(aStack)) {
- @Override
- public IMetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) {
- return new GregtechMetaCreativeEnergyBuffer(this.mName, this.mTier, this.mDescription, this.mTextures,
- this.mInventory.length);
- }
- @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++;
+ if (aStack.getItem() instanceof GT_MetaBase_Item) {
+ 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);
}
- this.mChargeableCount++;
}
}
+
}
- }
- @Override
- public int rechargerSlotCount() {
- return this.mCharge ? this.mInventory.length : 0;
+ return new long[] { tStored, tScale };
}
+ private long count=0;
+ private long mStored=0;
+ private long mMax=0;
+
@Override
- public int rechargerSlotStartIndex() {
- return 0;
+ public String[] getInfoData() {
+ count++;
+ if(mMax==0||count%20==0){
+ long[] tmp = getStoredEnergy();
+ mStored=tmp[0];
+ mMax=tmp[1];
+ }
+
+ return new String[] {
+ getLocalName(),
+ "THIS IS A CREATIVE ITEM - FOR TESTING",
+ GT_Utility.formatNumbers(mStored)+" EU /",
+ GT_Utility.formatNumbers(mMax)+" EU"};
}
@Override
- public void saveNBTData(final NBTTagCompound aNBT) {
- //
+ public boolean isGivingInformation() {
+ return true;
}
} \ No newline at end of file