diff options
author | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 22:15:09 -0400 |
---|---|---|
committer | Shawn Buckley <shawntbuckley@gmail.com> | 2015-10-21 22:15:09 -0400 |
commit | 123aa6ed288b2f67b0d47177f4d27cd6893daf3a (patch) | |
tree | 358e3704182f5b6fda44fa8b20605ab63edca092 /src/main/java/gregtech/common/tileentities/automation | |
parent | 43ddecc7b9715d2038747566f89930b5db8d0181 (diff) | |
download | GT5-Unofficial-123aa6ed288b2f67b0d47177f4d27cd6893daf3a.tar.gz GT5-Unofficial-123aa6ed288b2f67b0d47177f4d27cd6893daf3a.tar.bz2 GT5-Unofficial-123aa6ed288b2f67b0d47177f4d27cd6893daf3a.zip |
Reformat code
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/automation')
5 files changed, 309 insertions, 381 deletions
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index f8bf845ea8..b078f558f7 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -13,63 +12,52 @@ import gregtech.common.gui.GT_GUIContainer_ChestBuffer; import net.minecraft.entity.player.InventoryPlayer;
public class GT_MetaTileEntity_ChestBuffer
- extends GT_MetaTileEntity_Buffer
-{
- public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 28, "Buffering lots of incoming Items");
- }
-
- public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription)
- {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
- }
-
- public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures)
- {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- public ITexture getOverlayIcon()
- {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_CHESTBUFFER);
- }
-
- public boolean isValidSlot(int aIndex)
- {
- return aIndex < this.mInventory.length - 1;
- }
-
- protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer)
- {
- fillStacksIntoFirstSlots();
- super.moveItems(aBaseMetaTileEntity, aTimer);
- fillStacksIntoFirstSlots();
- }
-
- protected void fillStacksIntoFirstSlots()
- {
- for (int i = 0; i < this.mInventory.length - 1; i++) {
- for (int j = i + 1; j < this.mInventory.length - 1; j++) {
- if ((this.mInventory[j] != null) && ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) {
- GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte)64, (byte)1, (byte)64, (byte)1);
+ extends GT_MetaTileEntity_Buffer {
+ public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 28, "Buffering lots of incoming Items");
+ }
+
+ public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
+ }
+
+ public GT_MetaTileEntity_ChestBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_CHESTBUFFER);
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < this.mInventory.length - 1;
+ }
+
+ protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ fillStacksIntoFirstSlots();
+ super.moveItems(aBaseMetaTileEntity, aTimer);
+ fillStacksIntoFirstSlots();
+ }
+
+ protected void fillStacksIntoFirstSlots() {
+ for (int i = 0; i < this.mInventory.length - 1; i++) {
+ for (int j = i + 1; j < this.mInventory.length - 1; j++) {
+ if ((this.mInventory[j] != null) && ((this.mInventory[i] == null) || (GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j])))) {
+ GT_Utility.moveStackFromSlotAToSlotB(getBaseMetaTileEntity(), getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
+ }
+ }
}
- }
}
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
- }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java index 09aac62b2e..4180484ad5 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -15,74 +14,62 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_Filter
- extends GT_MetaTileEntity_Buffer
-{
- public boolean bIgnoreNBT = false;
- public boolean bInvertFilter = false;
-
- public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 19, "Filtering incoming Items");
- }
-
- public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures)
- {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- public ITexture getOverlayIcon()
- {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_FILTER);
- }
-
- public boolean isValidSlot(int aIndex)
- {
- return aIndex < 9;
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_Container_Filter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_GUIContainer_Filter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public void saveNBTData(NBTTagCompound aNBT)
- {
- super.saveNBTData(aNBT);
- aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
- aNBT.setBoolean("bIgnoreNBT", this.bIgnoreNBT);
- }
-
- public void loadNBTData(NBTTagCompound aNBT)
- {
- super.loadNBTData(aNBT);
- this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
- this.bIgnoreNBT = aNBT.getBoolean("bIgnoreNBT");
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
- return false;
+ extends GT_MetaTileEntity_Buffer {
+ public boolean bIgnoreNBT = false;
+ public boolean bInvertFilter = false;
+
+ public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 19, "Filtering incoming Items");
+ }
+
+ public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
}
- if (this.bInvertFilter)
- {
- for (byte i = 9; i < 18; i = (byte)(i + 1)) {
- if (GT_Utility.areStacksEqual(this.mInventory[i], aStack, this.bIgnoreNBT)) {
- return false;
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_FILTER);
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 9;
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_Filter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_Filter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
+ aNBT.setBoolean("bIgnoreNBT", this.bIgnoreNBT);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
+ this.bIgnoreNBT = aNBT.getBoolean("bIgnoreNBT");
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) {
+ return false;
+ }
+ if (this.bInvertFilter) {
+ for (byte i = 9; i < 18; i = (byte) (i + 1)) {
+ if (GT_Utility.areStacksEqual(this.mInventory[i], aStack, this.bIgnoreNBT)) {
+ return false;
+ }
+ }
+ return true;
}
- }
- return true;
+ return GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT);
}
- return GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT);
- }
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index 6790d1d717..3a89b8c82e 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -10,98 +9,85 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_Regulator;
import gregtech.common.gui.GT_GUIContainer_Regulator;
-
-import java.util.Arrays;
-
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import java.util.Arrays;
+
public class GT_MetaTileEntity_Regulator
- extends GT_MetaTileEntity_Buffer
-{
- public int[] mTargetSlots = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-
- public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items");
- }
-
- public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures)
- {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- public ITexture getOverlayIcon()
- {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_REGULATOR);
- }
-
- public boolean isValidSlot(int aIndex)
- {
- return aIndex < 9;
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_Container_Regulator(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_GUIContainer_Regulator(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public void saveNBTData(NBTTagCompound aNBT)
- {
- super.saveNBTData(aNBT);
- aNBT.setInteger("mTargetSlot1", this.mTargetSlots[0]);
- aNBT.setInteger("mTargetSlot2", this.mTargetSlots[1]);
- aNBT.setInteger("mTargetSlot3", this.mTargetSlots[2]);
- aNBT.setInteger("mTargetSlot4", this.mTargetSlots[3]);
- aNBT.setInteger("mTargetSlot5", this.mTargetSlots[4]);
- aNBT.setInteger("mTargetSlot6", this.mTargetSlots[5]);
- aNBT.setInteger("mTargetSlot7", this.mTargetSlots[6]);
- aNBT.setInteger("mTargetSlot8", this.mTargetSlots[7]);
- aNBT.setInteger("mTargetSlot9", this.mTargetSlots[8]);
- }
-
- public void loadNBTData(NBTTagCompound aNBT)
- {
- super.loadNBTData(aNBT);
- this.mTargetSlots[0] = aNBT.getInteger("mTargetSlot1");
- this.mTargetSlots[1] = aNBT.getInteger("mTargetSlot2");
- this.mTargetSlots[2] = aNBT.getInteger("mTargetSlot3");
- this.mTargetSlots[3] = aNBT.getInteger("mTargetSlot4");
- this.mTargetSlots[4] = aNBT.getInteger("mTargetSlot5");
- this.mTargetSlots[5] = aNBT.getInteger("mTargetSlot6");
- this.mTargetSlots[6] = aNBT.getInteger("mTargetSlot7");
- this.mTargetSlots[7] = aNBT.getInteger("mTargetSlot8");
- this.mTargetSlots[8] = aNBT.getInteger("mTargetSlot9");
- }
-
- public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer)
- {
- int i = 0;
- for (int tCosts = 0; i < 9; i++) {
- if (this.mInventory[(i + 9)] != null)
- {
- tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[] { this.mInventory[(i + 9)] }), false, (byte)this.mInventory[(i + 9)].stackSize, (byte)this.mInventory[(i + 9)].stackSize, (byte)64, (byte)1) * 3;
- if (tCosts > 0)
- {
- this.mSuccess = 50;getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true); break;
+ extends GT_MetaTileEntity_Buffer {
+ public int[] mTargetSlots = {0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+ public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 19, "Regulating incoming Items");
+ }
+
+ public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_REGULATOR);
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 9;
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_Regulator(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_Regulator(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setInteger("mTargetSlot1", this.mTargetSlots[0]);
+ aNBT.setInteger("mTargetSlot2", this.mTargetSlots[1]);
+ aNBT.setInteger("mTargetSlot3", this.mTargetSlots[2]);
+ aNBT.setInteger("mTargetSlot4", this.mTargetSlots[3]);
+ aNBT.setInteger("mTargetSlot5", this.mTargetSlots[4]);
+ aNBT.setInteger("mTargetSlot6", this.mTargetSlots[5]);
+ aNBT.setInteger("mTargetSlot7", this.mTargetSlots[6]);
+ aNBT.setInteger("mTargetSlot8", this.mTargetSlots[7]);
+ aNBT.setInteger("mTargetSlot9", this.mTargetSlots[8]);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mTargetSlots[0] = aNBT.getInteger("mTargetSlot1");
+ this.mTargetSlots[1] = aNBT.getInteger("mTargetSlot2");
+ this.mTargetSlots[2] = aNBT.getInteger("mTargetSlot3");
+ this.mTargetSlots[3] = aNBT.getInteger("mTargetSlot4");
+ this.mTargetSlots[4] = aNBT.getInteger("mTargetSlot5");
+ this.mTargetSlots[5] = aNBT.getInteger("mTargetSlot6");
+ this.mTargetSlots[6] = aNBT.getInteger("mTargetSlot7");
+ this.mTargetSlots[7] = aNBT.getInteger("mTargetSlot8");
+ this.mTargetSlots[8] = aNBT.getInteger("mTargetSlot9");
+ }
+
+ public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ int i = 0;
+ for (int tCosts = 0; i < 9; i++) {
+ if (this.mInventory[(i + 9)] != null) {
+ tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[]{this.mInventory[(i + 9)]}), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3;
+ if (tCosts > 0) {
+ this.mSuccess = 50;
+ getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCosts, true);
+ break;
+ }
+ }
}
- }
}
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)]));
- }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)]));
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java index 46c0fde6f5..212c354fba 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java @@ -1,7 +1,6 @@ package gregtech.common.tileentities.automation;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -11,35 +10,28 @@ import gregtech.common.gui.GT_GUIContainer_SuperBuffer; import net.minecraft.entity.player.InventoryPlayer;
public class GT_MetaTileEntity_SuperBuffer
- extends GT_MetaTileEntity_ChestBuffer
-{
- public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 257, "Buffering up to 256 Stacks");
- }
-
- public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures)
- {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- public ITexture getOverlayIcon()
- {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_SUPERBUFFER);
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_Container_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_GUIContainer_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity);
- }
+ extends GT_MetaTileEntity_ChestBuffer {
+ public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 257, "Buffering up to 256 Stacks");
+ }
+
+ public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_SUPERBUFFER);
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_SuperBuffer(aPlayerInventory, aBaseMetaTileEntity);
+ }
}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index 7af20757dd..854596650c 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -1,9 +1,7 @@ package gregtech.common.tileentities.automation;
-import gregtech.api.enums.OreDictNames;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
-import gregtech.api.enums.Textures.BlockIcons;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -14,146 +12,123 @@ import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility;
import gregtech.common.gui.GT_Container_TypeFilter;
import gregtech.common.gui.GT_GUIContainer_TypeFilter;
-
-import java.util.ArrayList;
-
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_TypeFilter
- extends GT_MetaTileEntity_Buffer
-{
- public boolean bNBTAllowed = false;
- public boolean bInvertFilter = false;
- public int mRotationIndex = 0;
- public OrePrefixes mPrefix = OrePrefixes.ore;
-
- public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier)
- {
- super(aID, aName, aNameRegional, aTier, 11, "Filtering incoming Items by Type");
- }
-
- public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures)
- {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity)
- {
- return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
- }
-
- public ITexture getOverlayIcon()
- {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_TYPEFILTER);
- }
-
- public boolean isValidSlot(int aIndex)
- {
- return aIndex < 9;
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity)
- {
- return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public void clickTypeIcon(boolean aRightClick)
- {
- if (getBaseMetaTileEntity().isServerSide())
- {
- for (int i = 0; i < OrePrefixes.values().length; i++) {
- if (this.mPrefix == OrePrefixes.values()[i]) {
- for (this.mPrefix = null; this.mPrefix == null; this.mPrefix = OrePrefixes.values()[i])
- {
- if (aRightClick)
- {
- do{
- i--;
- if (i < 0) {
- i = OrePrefixes.values().length - 1;
- }
- }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty());
-
+ extends GT_MetaTileEntity_Buffer {
+ public boolean bNBTAllowed = false;
+ public boolean bInvertFilter = false;
+ public int mRotationIndex = 0;
+ public OrePrefixes mPrefix = OrePrefixes.ore;
+
+ public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 11, "Filtering incoming Items by Type");
+ }
+
+ public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescription, this.mTextures);
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_TYPEFILTER);
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 9;
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public void clickTypeIcon(boolean aRightClick) {
+ if (getBaseMetaTileEntity().isServerSide()) {
+ for (int i = 0; i < OrePrefixes.values().length; i++) {
+ if (this.mPrefix == OrePrefixes.values()[i]) {
+ for (this.mPrefix = null; this.mPrefix == null; this.mPrefix = OrePrefixes.values()[i]) {
+ if (aRightClick) {
+ do {
+ i--;
+ if (i < 0) {
+ i = OrePrefixes.values().length - 1;
+ }
+ } while (OrePrefixes.values()[i].mPrefixedItems.isEmpty());
+
+ } else {
+ do {
+ i++;
+ if (i >= OrePrefixes.values().length) {
+ i = 0;
+ }
+ } while (OrePrefixes.values()[i].mPrefixedItems.isEmpty());
+ }
+ if (!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i])
+ mPrefix = OrePrefixes.values()[i];
+ }
+ }
+ }
+ this.mRotationIndex = 0;
+ }
+ }
+
+ public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPreTick(aBaseMetaTileEntity, aTick);
+ if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) {
+ if (this.mPrefix.mPrefixedItems.isEmpty()) {
+ this.mInventory[9] = null;
+ } else {
+ this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[]{this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())});
+ if (this.mInventory[9].getItemDamage() == 32767) {
+ this.mInventory[9].setItemDamage(0);
+ }
+ this.mInventory[9].setStackDisplayName(this.mPrefix.toString());
}
- else
- {
- do{
- i++;
- if (i >= OrePrefixes.values().length) {
- i = 0;
- }
- }while(OrePrefixes.values()[i].mPrefixedItems.isEmpty());
+ }
+ }
+
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setString("mPrefix", this.mPrefix.toString());
+ aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
+ aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed);
+ }
+
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix);
+ this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
+ this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed");
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ boolean tAllowPrefix = this.mPrefix.contains(aStack);
+ if (this.mPrefix == OrePrefixes.ore) {
+ ItemData tData = GT_OreDictUnificator.getItemData(aStack);
+ if (tData != null && tData.mPrefix != null) {
+ OrePrefixes tFix = tData.mPrefix;
+ if (tFix == OrePrefixes.oreBlackgranite ||
+ tFix == OrePrefixes.oreDense ||
+ tFix == OrePrefixes.oreEnd ||
+ tFix == OrePrefixes.oreEndstone ||
+ tFix == OrePrefixes.oreNether ||
+ tFix == OrePrefixes.oreNetherrack ||
+ tFix == OrePrefixes.oreNormal ||
+ tFix == OrePrefixes.orePoor ||
+ tFix == OrePrefixes.oreRedgranite ||
+ tFix == OrePrefixes.oreRich ||
+ tFix == OrePrefixes.oreSmall) tAllowPrefix = true;
}
- if(!OrePrefixes.values()[i].mPrefixedItems.isEmpty() && OrePrefixes.values()[i].mPrefixInto == OrePrefixes.values()[i])
- mPrefix = OrePrefixes.values()[i];
- }
}
- }
- this.mRotationIndex = 0;
+ return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter);
}
- }
-
- public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick)
- {
- super.onPreTick(aBaseMetaTileEntity, aTick);
- if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) {
- if (this.mPrefix.mPrefixedItems.isEmpty())
- {
- this.mInventory[9] = null;
- }
- else
- {
- this.mInventory[9] = GT_Utility.copyAmount(1L, new Object[] { this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()) });
- if (this.mInventory[9].getItemDamage() == 32767) {
- this.mInventory[9].setItemDamage(0);
- }
- this.mInventory[9].setStackDisplayName(this.mPrefix.toString());
- }
- }
- }
-
- public void saveNBTData(NBTTagCompound aNBT)
- {
- super.saveNBTData(aNBT);
- aNBT.setString("mPrefix", this.mPrefix.toString());
- aNBT.setBoolean("bInvertFilter", this.bInvertFilter);
- aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed);
- }
-
- public void loadNBTData(NBTTagCompound aNBT)
- {
- super.loadNBTData(aNBT);
- this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix);
- this.bInvertFilter = aNBT.getBoolean("bInvertFilter");
- this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed");
- }
-
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
- {
- boolean tAllowPrefix = this.mPrefix.contains(aStack);
- if(this.mPrefix==OrePrefixes.ore){
- ItemData tData = GT_OreDictUnificator.getItemData(aStack);
- if(tData!=null&&tData.mPrefix!=null){
- OrePrefixes tFix = tData.mPrefix;
- if(tFix==OrePrefixes.oreBlackgranite||
- tFix==OrePrefixes.oreDense||
- tFix==OrePrefixes.oreEnd||
- tFix==OrePrefixes.oreEndstone||
- tFix==OrePrefixes.oreNether||
- tFix==OrePrefixes.oreNetherrack||
- tFix==OrePrefixes.oreNormal||
- tFix==OrePrefixes.orePoor||
- tFix==OrePrefixes.oreRedgranite||
- tFix==OrePrefixes.oreRich||
- tFix==OrePrefixes.oreSmall)tAllowPrefix=true;
- }}
- return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && ((this.bNBTAllowed) || (!aStack.hasTagCompound())) && (tAllowPrefix != this.bInvertFilter);
- }
}
|