aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java23
-rw-r--r--src/main/java/gregtech/api/util/GT_LanguageManager.java2
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java7
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java2
-rw-r--r--src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java2
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java86
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java3
-rw-r--r--src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java6
8 files changed, 68 insertions, 63 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index 73ab28822a..a57f2440a7 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -12,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
import static gregtech.api.enums.GT_Values.V;
public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock {
- public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = true;
+ public boolean bOutput = false, bRedstoneIfFull = false, bInvert = false, bStockingMode = false;
public int mSuccess = 0, mTargetStackSize = 0;
public GT_MetaTileEntity_Buffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
@@ -257,18 +257,15 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
}
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if( bStockingMode ) {
- int tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize, (byte) 64, (byte) 1);
- if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true);
- }
- } else {
- int tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize);
- if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
- mSuccess = 50;
- aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true);
- }
+ int tCost;
+ if( bStockingMode )
+ tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, (byte) 1, (byte) 64, (byte) 1);
+ else
+ tCost = GT_Utility.moveOneItemStack(aBaseMetaTileEntity, aBaseMetaTileEntity.getTileEntityAtSide(aBaseMetaTileEntity.getBackFacing()), aBaseMetaTileEntity.getBackFacing(), aBaseMetaTileEntity.getFrontFacing(), null, false, (byte) 64, (byte) 1, mTargetStackSize == 0 ? 64 : (byte) mTargetStackSize, mTargetStackSize == 0 ? 1 : (byte) mTargetStackSize);
+
+ if (tCost > 0 || aBaseMetaTileEntity.hasInventoryBeenModified()) {
+ mSuccess = 50;
+ aBaseMetaTileEntity.decreaseStoredEnergyUnits(Math.abs(tCost), true);
}
}
diff --git a/src/main/java/gregtech/api/util/GT_LanguageManager.java b/src/main/java/gregtech/api/util/GT_LanguageManager.java
index b44b6ffa40..c87e0f7417 100644
--- a/src/main/java/gregtech/api/util/GT_LanguageManager.java
+++ b/src/main/java/gregtech/api/util/GT_LanguageManager.java
@@ -323,7 +323,7 @@ public class GT_LanguageManager {
addStringLocalization("Interaction_DESCRIPTION_Index_214", "Connected");
addStringLocalization("Interaction_DESCRIPTION_Index_215", "Disconnected");
addStringLocalization("Interaction_DESCRIPTION_Index_216", "Deprecated Recipe");
- addStringLocalization("Interaction_DESCRIPTION_Index_217", "Stocking mode. Keeps this many items in destination input slots.");
+ addStringLocalization("Interaction_DESCRIPTION_Index_217", "Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly.");
addStringLocalization("Interaction_DESCRIPTION_Index_218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room.");
addStringLocalization("Interaction_DESCRIPTION_Index_500", "Fitting: Loose - More Flow");
addStringLocalization("Interaction_DESCRIPTION_Index_501", "Fitting: Tight - More Efficiency");
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index 6df77f16bf..a65ed00aed 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -547,7 +547,7 @@ public class GT_Utility {
for (int i = 0; i < tGrabSlots.length; i++) tGrabSlots[i] = i;
}
- if (aTileEntity2 != null && aTileEntity2 instanceof IInventory) {
+ if (aTileEntity2 instanceof IInventory) {
int[] tPutSlots = null;
if (aTileEntity2 instanceof ISidedInventory)
tPutSlots = ((ISidedInventory) aTileEntity2).getAccessibleSlotsFromSide(aPutTo);
@@ -561,13 +561,12 @@ public class GT_Utility {
byte tMovedItemCount = 0;
ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlots[i]);
if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) {
- if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) {
+ if (tGrabStack.stackSize >= aMinMoveAtOnce && isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) {
for (int j = 0; j < tPutSlots.length; j++) {
if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, tGrabStack, aMaxTargetStackSize)) {
tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
- if (tMovedItemCount >= aMaxMoveAtOnce) {
+ if (tMovedItemCount >= aMaxMoveAtOnce ||(tMovedItemCount > 0 && aMaxTargetStackSize < 64))
return tMovedItemCount;
- }
}
}
}
diff --git a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
index 016d0889f7..d465134d5e 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_ChestBuffer.java
@@ -67,7 +67,7 @@ public class GT_Container_ChestBuffer
if (aSlotIndex == 30) {
((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode);
if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots."));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
}
diff --git a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
index 5a59cb5aa9..530e64aa68 100644
--- a/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
+++ b/src/main/java/gregtech/common/gui/GT_Container_SuperBuffer.java
@@ -62,7 +62,7 @@ public class GT_Container_SuperBuffer
if (aSlotIndex == 3) {
((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode = (!((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode);
if (((GT_MetaTileEntity_ChestBuffer) this.mTileEntity.getMetaTileEntity()).bStockingMode) {
- GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots."));
+ GT_Utility.sendChatToPlayer(aPlayer, trans("217","Stocking mode. Keeps this many items in destination input slots. This mode can be server unfriendly."));
} else {
GT_Utility.sendChatToPlayer(aPlayer, trans("218", "Transfer size mode. Add exactly this many items in destination input slots as long as there is room."));
}
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 d11b1f2f81..6605d4fc35 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
@@ -19,11 +19,15 @@ import java.util.Comparator;
public class GT_MetaTileEntity_ChestBuffer
extends GT_MetaTileEntity_Buffer {
+ private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1,1,1};
+
+
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"});
+ "Consumes 3EU per moved Item",
+ getTickRateDesc(aTier)});
}
public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) {
@@ -55,6 +59,8 @@ public class GT_MetaTileEntity_ChestBuffer
}
protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
+ if (aTimer % tickRate[mTier] > 0) return;
+
if(aBaseMetaTileEntity.hasInventoryBeenModified()) {
fillStacksIntoFirstSlots();
}
@@ -64,9 +70,9 @@ public class GT_MetaTileEntity_ChestBuffer
super.moveItems(aBaseMetaTileEntity, aTimer);
}
// mSuccesss is set to 50 on a successful move
- if(mSuccess == 50) {
- fillStacksIntoFirstSlots();
- }
+ //if(mSuccess == 50) {
+ // fillStacksIntoFirstSlots();
+ //}
if(mSuccess < 0) {
mSuccess = 0;
}
@@ -85,47 +91,32 @@ public class GT_MetaTileEntity_ChestBuffer
return 1;
Item item1 = o1.getItem();
Item item2 = o2.getItem();
-
- // If item1 is a block and item2 isn't, sort item1 before item2
- if (((item1 instanceof ItemBlock)) && (!(item2 instanceof ItemBlock))) {
+
+ if(item1 instanceof ItemBlock) {
+ if (!(item2 instanceof ItemBlock))
+ return -1; // If item1 is a block and item2 isn't, sort item1 before item2
+ } else if (item2 instanceof ItemBlock)
+ return 1; // If item2 is a block and item1 isn't, sort item1 after item2
+
+ int id1 = Item.getIdFromItem( item1 );
+ int id2 = Item.getIdFromItem( item2 );
+ if ( id1 < id2 ) {
return -1;
}
-
- // If item2 is a block and item1 isn't, sort item1 after item2
- if (((item2 instanceof ItemBlock)) && (!(item1 instanceof ItemBlock))) {
+ if ( id1 > id2 ) {
return 1;
}
- // If the items are blocks, use the string comparison
- if ((item1 instanceof ItemBlock)) { // only need to check one since we did the check above
- String displayName1 = o1.getDisplayName();
- String displayName2 = o2.getDisplayName();
- int result = displayName1.compareToIgnoreCase(displayName2);
- //GT_FML_LOGGER.info("sorter: " + displayName1 + " " + displayName2 + " " + result);
- return result;
- } else
- {
- // Not a block. Use the ID and damage to compare them.
- int id1 = Item.getIdFromItem( item1 );
- int id2 = Item.getIdFromItem( item2 );
- if ( id1 < id2 ) {
- return -1;
- }
- if ( id1 > id2 ) {
- return 1;
- }
- // id1 must equal id2, get their damage and compare
- id1 = o1.getItemDamage();
- id2 = o2.getItemDamage();
-
- if ( id1 < id2 ) {
- return -1;
- }
- if ( id1 > id2 ) {
- return 1;
- }
- return 0;
+ id1 = o1.getItemDamage();
+ id2 = o2.getItemDamage();
+
+ if ( id1 < id2 ) {
+ return -1;
+ }
+ if ( id1 > id2 ) {
+ return 1;
}
+ return 0;
}
});
}
@@ -155,4 +146,21 @@ public class GT_MetaTileEntity_ChestBuffer
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity);
}
+
+ protected static String getTickRateDesc(int tier){
+ int tickRate = getTickRate(tier);
+ String s = "";
+ if (tickRate < 20)
+ s = "1/" + 20/tickRate + " ";
+ else if (tickRate > 20) {
+ s = (tickRate / 20) + "th ";
+ }
+ return "Moves items every " + s + "second";
+ }
+
+ protected static int getTickRate(int tier) {
+ if (tier > 9)
+ return 1;
+ return tickRate[tier];
+ }
}
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 10fcb47d12..da35f17518 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
@@ -15,7 +15,8 @@ public class GT_MetaTileEntity_SuperBuffer
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"});
+ "Consumes 1EU per moved Item",
+ getTickRateDesc(aTier)});
}
public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) {
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 9b9f782601..6292a769a2 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
@@ -83,17 +83,17 @@ public class GT_MetaTileEntity_TypeFilter
}
}
}
- this.mRotationIndex = 0;
+ this.mRotationIndex = -1;
}
}
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
- if ((getBaseMetaTileEntity().isServerSide()) && (aTick % 8L == 0L)) {
+ if ((getBaseMetaTileEntity().isServerSide()) && ((aTick % 8L == 0L) || mRotationIndex == -1)) {
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())});
+ this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size()));
if (this.mInventory[9].getItemDamage() == 32767) {
this.mInventory[9].setItemDamage(0);
}