aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/automation
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/automation')
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java148
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java164
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java344
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java14
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java88
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java6
6 files changed, 382 insertions, 382 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 e6d6beac8c..7385bb31b1 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,74 +1,74 @@
-package gregtech.common.tileentities.automation;
-
-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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.GT_Container_ChestBuffer;
-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, new String[]{
- "Buffers up to 27 Item Stacks",
- "Use Screwdriver to regulate output stack size",
- "Consumes 1EU per moved Item"});
- }
-
- 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(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 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.mDescriptionArray, 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);
- }
-}
+package gregtech.common.tileentities.automation;
+
+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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.gui.GT_Container_ChestBuffer;
+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, new String[]{
+ "Buffers up to 27 Item Stacks",
+ "Use Screwdriver to regulate output stack size",
+ "Consumes 3EU per moved Item"});
+ }
+
+ 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(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 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.mDescriptionArray, 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);
+ }
+}
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 f8a2de85a3..a2f17ef6f3 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,82 +1,82 @@
-package gregtech.common.tileentities.automation;
-
-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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.GT_Container_Filter;
-import gregtech.common.gui.GT_GUIContainer_Filter;
-import net.minecraft.entity.player.InventoryPlayer;
-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, new String[]{
- "Filters up to 9 different Items",
- "Use Screwdriver to regulate output stack size",
- "Consumes 1EU per moved Item"});
- }
-
- public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- 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.mDescriptionArray, 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;
- }
- 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 GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT);
- }
-}
+package gregtech.common.tileentities.automation;
+
+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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.gui.GT_Container_Filter;
+import gregtech.common.gui.GT_GUIContainer_Filter;
+import net.minecraft.entity.player.InventoryPlayer;
+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, new String[]{
+ "Filters up to 9 different Items",
+ "Use Screwdriver to regulate output stack size",
+ "Consumes 1EU per moved Item"});
+ }
+
+ public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ 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.mDescriptionArray, 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;
+ }
+ 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 GT_Utility.areStacksEqual(this.mInventory[(aIndex + 9)], aStack, this.bIgnoreNBT);
+ }
+}
diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
index 7f53fd31f7..5fa3bc8c82 100644
--- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
+++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java
@@ -1,172 +1,172 @@
-package gregtech.common.tileentities.automation;
-
-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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
-import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
-import gregtech.common.gui.GT_Container_ItemDistributor;
-import gregtech.common.gui.GT_GUIContainer_ItemDistributor;
-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.tileentity.TileEntity;
-
-public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer {
- private byte[] itemsPerSide = new byte[6];
- private byte currentSide = 0, currentSideItemCount = 0;
-
- public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 28, new String[]{
- "Distributes Items between different Machine Sides",
- "Default Items per Machine Side: 0",
- "Use Screwdriver to increase/decrease Items per Side",
- "Consumes 1EU per moved Item"});
- }
-
- public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
- String aDescription) {
- super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
- }
-
- public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- public GT_MetaTileEntity_ItemDistributor(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_ItemDistributor(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray,
- this.mTextures);
- }
-
- 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 getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- public ITexture getOverlayIcon() {
- return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR);
- }
-
- public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
- }
-
- @Override
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == aBaseMetaTileEntity.getFrontFacing();
- }
-
- @Override
- public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- if (aSide == aFacing) {
- return mTextures[0][aColorIndex + 1];
- } else {
- return mTextures[1][aColorIndex + 1];
- }
- }
-
- @Override
- public ITexture[][][] getTextureSet(ITexture[] aTextures) {
- ITexture[][][] returnTextures = new ITexture[2][17][];
- ITexture baseIcon = getOverlayIcon(), pipeIcon = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT);
- for (int i = 0; i < 17; i++) {
- returnTextures[0][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon};
- returnTextures[1][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon};
- }
- return returnTextures;
- }
-
- @Override
- public boolean isInputFacing(byte aSide) {
- return getBaseMetaTileEntity().getFrontFacing() == aSide || itemsPerSide[aSide] == 0;
- }
-
- @Override
- public boolean isOutputFacing(byte aSide) {
- return getBaseMetaTileEntity().getFrontFacing() != aSide && itemsPerSide[aSide] > 0;
- }
-
- public boolean isValidSlot(int aIndex) {
- return aIndex < this.mInventory.length - 1;
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- itemsPerSide = aNBT.getByteArray("mItemsPerSide");
- if (itemsPerSide.length != 6) {
- itemsPerSide = new byte[6];
- }
- currentSide = aNBT.getByte("mCurrentSide");
- currentSideItemCount = aNBT.getByte("mCurrentSideItemCount");
- }
-
- protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- fillStacksIntoFirstSlots();
- int movedItems = 0;
- TileEntity adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
- int inspectedSides = 0;
- while (itemsPerSide[currentSide] == 0) {
- currentSide = (byte) ((currentSide + 1) % 6);
- currentSideItemCount = 0;
- adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
- inspectedSides += 1;
- if (inspectedSides == 6) {
- return;
- }
- }
- movedItems = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, adjacentTileEntity, currentSide,
- GT_Utility.getOppositeSide(currentSide), null, false, (byte) 64, (byte) 1,
- (byte) (itemsPerSide[currentSide] - currentSideItemCount), (byte) 1);
- currentSideItemCount += movedItems;
- if (currentSideItemCount >= itemsPerSide[currentSide]) {
- currentSide = (byte) ((currentSide + 1) % 6);
- currentSideItemCount = 0;
- }
- if (movedItems > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(movedItems), true);
- }
- fillStacksIntoFirstSlots();
- }
-
- @Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- //Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127]
- itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1;
- itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128);
- GT_Utility.sendChatToPlayer(aPlayer, trans("211", "Items per side: ") + itemsPerSide[aSide]);
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- aNBT.setByteArray("mItemsPerSide", itemsPerSide);
- aNBT.setByte("mCurrentSide", currentSide);
- aNBT.setByte("mCurrentSideItemCount", currentSideItemCount);
- }
-
- @Override
- public void setItemNBT(NBTTagCompound aNBT) {
- super.setItemNBT(aNBT);
- aNBT.setByteArray("mItemsPerSide", itemsPerSide);
- }
-}
+package gregtech.common.tileentities.automation;
+
+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.metatileentity.implementations.GT_MetaTileEntity_Buffer;
+import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.util.GT_Utility;
+import gregtech.common.gui.GT_Container_ItemDistributor;
+import gregtech.common.gui.GT_GUIContainer_ItemDistributor;
+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.tileentity.TileEntity;
+
+public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer {
+ private byte[] itemsPerSide = new byte[6];
+ private byte currentSide = 0, currentSideItemCount = 0;
+
+ public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier) {
+ super(aID, aName, aNameRegional, aTier, 28, new String[]{
+ "Distributes Items between different Machine Sides",
+ "Default Items per Machine Side: 0",
+ "Use Screwdriver to increase/decrease Items per Side",
+ "Consumes 1EU per moved Item"});
+ }
+
+ public GT_MetaTileEntity_ItemDistributor(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount,
+ String aDescription) {
+ super(aID, aName, aNameRegional, aTier, aInvSlotCount, aDescription);
+ }
+
+ public GT_MetaTileEntity_ItemDistributor(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ public GT_MetaTileEntity_ItemDistributor(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_ItemDistributor(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray,
+ this.mTextures);
+ }
+
+ 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 getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_GUIContainer_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ public ITexture getOverlayIcon() {
+ return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR);
+ }
+
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new GT_Container_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return aSide == aBaseMetaTileEntity.getFrontFacing();
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
+ if (aSide == aFacing) {
+ return mTextures[0][aColorIndex + 1];
+ } else {
+ return mTextures[1][aColorIndex + 1];
+ }
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] returnTextures = new ITexture[2][17][];
+ ITexture baseIcon = getOverlayIcon(), pipeIcon = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT);
+ for (int i = 0; i < 17; i++) {
+ returnTextures[0][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon};
+ returnTextures[1][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon};
+ }
+ return returnTextures;
+ }
+
+ @Override
+ public boolean isInputFacing(byte aSide) {
+ return getBaseMetaTileEntity().getFrontFacing() == aSide || itemsPerSide[aSide] == 0;
+ }
+
+ @Override
+ public boolean isOutputFacing(byte aSide) {
+ return getBaseMetaTileEntity().getFrontFacing() != aSide && itemsPerSide[aSide] > 0;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < this.mInventory.length - 1;
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ itemsPerSide = aNBT.getByteArray("mItemsPerSide");
+ if (itemsPerSide.length != 6) {
+ itemsPerSide = new byte[6];
+ }
+ currentSide = aNBT.getByte("mCurrentSide");
+ currentSideItemCount = aNBT.getByte("mCurrentSideItemCount");
+ }
+
+ protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ fillStacksIntoFirstSlots();
+ int movedItems = 0;
+ TileEntity adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
+ int inspectedSides = 0;
+ while (itemsPerSide[currentSide] == 0) {
+ currentSide = (byte) ((currentSide + 1) % 6);
+ currentSideItemCount = 0;
+ adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide);
+ inspectedSides += 1;
+ if (inspectedSides == 6) {
+ return;
+ }
+ }
+ movedItems = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, adjacentTileEntity, currentSide,
+ GT_Utility.getOppositeSide(currentSide), null, false, (byte) 64, (byte) 1,
+ (byte) (itemsPerSide[currentSide] - currentSideItemCount), (byte) 1);
+ currentSideItemCount += movedItems;
+ if (currentSideItemCount >= itemsPerSide[currentSide]) {
+ currentSide = (byte) ((currentSide + 1) % 6);
+ currentSideItemCount = 0;
+ }
+ if (movedItems > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ mSuccess = 50;
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(movedItems), true);
+ }
+ fillStacksIntoFirstSlots();
+ }
+
+ @Override
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ //Adjust items per side by 1 or -1, constrained to the cyclic interval [0, 127]
+ itemsPerSide[aSide] += aPlayer.isSneaking() ? -1 : 1;
+ itemsPerSide[aSide] = (byte) ((itemsPerSide[aSide] + 128) % 128);
+ GT_Utility.sendChatToPlayer(aPlayer, trans("211", "Items per side: ") + itemsPerSide[aSide]);
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setByteArray("mItemsPerSide", itemsPerSide);
+ aNBT.setByte("mCurrentSide", currentSide);
+ aNBT.setByte("mCurrentSideItemCount", currentSideItemCount);
+ }
+
+ @Override
+ public void setItemNBT(NBTTagCompound aNBT) {
+ super.setItemNBT(aNBT);
+ aNBT.setByteArray("mItemsPerSide", itemsPerSide);
+ }
+} \ No newline at end of file
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 cfb1b757df..b4c819346c 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
@@ -23,10 +23,10 @@ public class GT_MetaTileEntity_Regulator
public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 20, new String[]{
- "Filters up to 9 different Items",
- "Allows Item-specific output stack size",
- "Allows Item-specific output slot",
- "Consumes 3EU per moved Item"});
+ "Filters up to 9 different Items",
+ "Allows Item-specific output stack size",
+ "Allows Item-specific output slot",
+ "Consumes 1EU per moved Item"});
}
public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
@@ -46,7 +46,7 @@ public class GT_MetaTileEntity_Regulator
}
public boolean isValidSlot(int aIndex) {
- return aIndex < 9 ;
+ return aIndex < 9;
}
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
@@ -84,8 +84,8 @@ public class GT_MetaTileEntity_Regulator
}
@Override
- public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
- //Regulation per Screwdriver is overridden by GUI regulation.
+ public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ //Regulation per Screwdriver is overridden by GUI regulation.
}
public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
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 57a753e86b..10fcb47d12 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,44 +1,44 @@
-package gregtech.common.tileentities.automation;
-
-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.common.gui.GT_Container_SuperBuffer;
-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, new String[]{
- "Buffers up to 256 Item Stacks",
- "Use Screwdriver to regulate output stack size",
- "Consumes 1EU per moved Item"});
- }
-
- public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
- super(aName, aTier, aInvSlotCount, aDescription, aTextures);
- }
-
- 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.mDescriptionArray, 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);
- }
-}
+package gregtech.common.tileentities.automation;
+
+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.common.gui.GT_Container_SuperBuffer;
+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, new String[]{
+ "Buffers up to 256 Item Stacks",
+ "Use Screwdriver to regulate output stack size",
+ "Consumes 1EU per moved Item"});
+ }
+
+ public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, aInvSlotCount, aDescription, aTextures);
+ }
+
+ 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.mDescriptionArray, 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 34e343a128..1d632ce7f2 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
@@ -25,9 +25,9 @@ public class GT_MetaTileEntity_TypeFilter
public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) {
super(aID, aName, aNameRegional, aTier, 11, new String[]{
- "Filters 1 Item Type",
- "Use Screwdriver to regulate output stack size",
- "Consumes 1 EU per moved Item"});
+ "Filters 1 Item Type",
+ "Use Screwdriver to regulate output stack size",
+ "Consumes 1 EU per moved Item"});
}
public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {