mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 14:53:05 +00:00
1 parent
9299db28a7
commit
9d8e572ac8
4 files changed
+21
-17
No files matched your search
@@ -48,9 +48,11 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
public static final short SLOT_LETTERS_COUNT = 6;
|
||||
public static final short SLOT_STAMPS_1 = 11;
|
||||
public static final short SLOT_STAMPS_COUNT = 4;
|
||||
public static final short SLOT_BUFFER = 15;
|
||||
public static final short SLOT_BUFFER_COUNT = 30;
|
||||
public static final short SLOT_SIZE = SLOT_TRADEGOOD_COUNT + SLOT_EXCHANGE_COUNT + SLOT_LETTERS_COUNT + SLOT_STAMPS_COUNT + SLOT_BUFFER_COUNT;
|
||||
public static final short SLOT_RECEIVE_BUFFER = 15;
|
||||
public static final short SLOT_RECEIVE_BUFFER_COUNT = 15;
|
||||
public static final short SLOT_SEND_BUFFER = 30;
|
||||
public static final short SLOT_SEND_BUFFER_COUNT = 10;
|
||||
public static final short SLOT_SIZE = SLOT_TRADEGOOD_COUNT + SLOT_EXCHANGE_COUNT + SLOT_LETTERS_COUNT + SLOT_STAMPS_COUNT + SLOT_RECEIVE_BUFFER_COUNT + SLOT_SEND_BUFFER_COUNT;
|
||||
|
||||
// / MEMBER
|
||||
private GameProfile owner;
|
||||
@@ -236,7 +238,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
if (stack == null)
|
||||
continue;
|
||||
|
||||
inventory.tryAddStack(stack.copy(), SLOT_BUFFER, SLOT_BUFFER_COUNT, false);
|
||||
inventory.tryAddStack(stack.copy(), SLOT_RECEIVE_BUFFER, SLOT_RECEIVE_BUFFER_COUNT, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,7 +278,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
|
||||
// How many orders are fillable?
|
||||
int itemCount = 0;
|
||||
for (ItemStack stack : inventory.getStacks(SLOT_BUFFER, SLOT_BUFFER_COUNT)) {
|
||||
for (ItemStack stack : inventory.getStacks(SLOT_SEND_BUFFER, SLOT_SEND_BUFFER_COUNT)) {
|
||||
if (stack != null && stack.isItemEqual(tradegood) && ItemStack.areItemStackTagsEqual(stack, tradegood))
|
||||
itemCount += stack.stackSize;
|
||||
}
|
||||
@@ -303,7 +305,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve
|
||||
|
||||
for (int j = 0; j < filled; j++) {
|
||||
int toRemove = inventory.getStackInSlot(SLOT_TRADEGOOD).stackSize;
|
||||
for (int i = SLOT_BUFFER; i < SLOT_BUFFER + SLOT_BUFFER_COUNT; i++) {
|
||||
for (int i = SLOT_SEND_BUFFER; i < SLOT_SEND_BUFFER + SLOT_SEND_BUFFER_COUNT; i++) {
|
||||
ItemStack buffer = inventory.getStackInSlot(i);
|
||||
if (buffer == null)
|
||||
continue;
|
||||
|
||||
@@ -131,7 +131,7 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
return;
|
||||
}
|
||||
|
||||
boolean hasSupplies = hasItemCount(TradeStation.SLOT_BUFFER, TradeStation.SLOT_BUFFER_COUNT, tradeGood, tradeGood.stackSize);
|
||||
boolean hasSupplies = hasItemCount(TradeStation.SLOT_SEND_BUFFER, TradeStation.SLOT_SEND_BUFFER_COUNT, tradeGood, tradeGood.stackSize);
|
||||
if(!hasSupplies) {
|
||||
setErrorState(EnumErrorCode.NOSUPPLIES);
|
||||
return;
|
||||
@@ -199,11 +199,11 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
ItemStack tradeGood = inventory.getStackInSlot(TradeStation.SLOT_TRADEGOOD);
|
||||
if (tradeGood == null)
|
||||
return true;
|
||||
return percentOccupied(TradeStation.SLOT_BUFFER, TradeStation.SLOT_BUFFER_COUNT, tradeGood) > percentage;
|
||||
return percentOccupied(TradeStation.SLOT_SEND_BUFFER, TradeStation.SLOT_SEND_BUFFER_COUNT, tradeGood) > percentage;
|
||||
}
|
||||
|
||||
public boolean hasOutputBufMin(float percentage) {
|
||||
return percentOccupied(TradeStation.SLOT_BUFFER, TradeStation.SLOT_BUFFER_COUNT, null) > percentage;
|
||||
return percentOccupied(TradeStation.SLOT_RECEIVE_BUFFER, TradeStation.SLOT_RECEIVE_BUFFER_COUNT, null) > percentage;
|
||||
}
|
||||
|
||||
public boolean hasPostageMin(int postage) {
|
||||
@@ -298,7 +298,7 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
if (!tradegood.isItemEqual(stack))
|
||||
return 0;
|
||||
|
||||
return StackUtils.addToInventory(stack, inventory, doAdd, TradeStation.SLOT_BUFFER, TradeStation.SLOT_BUFFER_COUNT);
|
||||
return StackUtils.addToInventory(stack, inventory, doAdd, TradeStation.SLOT_SEND_BUFFER, TradeStation.SLOT_SEND_BUFFER_COUNT);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -309,7 +309,7 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
|
||||
ItemStack product = null;
|
||||
IInventory inventory = getOrCreateTradeInventory();
|
||||
for (int i = TradeStation.SLOT_BUFFER; i < TradeStation.SLOT_BUFFER + TradeStation.SLOT_BUFFER_COUNT; i++) {
|
||||
for (int i = TradeStation.SLOT_RECEIVE_BUFFER; i < TradeStation.SLOT_RECEIVE_BUFFER + TradeStation.SLOT_RECEIVE_BUFFER_COUNT; i++) {
|
||||
ItemStack stackSlot = inventory.getStackInSlot(i);
|
||||
if (stackSlot == null)
|
||||
continue;
|
||||
@@ -345,7 +345,7 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
if(!super.canTakeStackFromSide(slotIndex, itemstack, side))
|
||||
return false;
|
||||
|
||||
if(slotIndex >= TradeStation.SLOT_BUFFER && slotIndex < TradeStation.SLOT_BUFFER + TradeStation.SLOT_BUFFER_COUNT)
|
||||
if(slotIndex >= TradeStation.SLOT_RECEIVE_BUFFER && slotIndex < TradeStation.SLOT_RECEIVE_BUFFER + TradeStation.SLOT_RECEIVE_BUFFER_COUNT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -365,7 +365,7 @@ public class MachineTrader extends TileBase implements ISpecialInventory, ISided
|
||||
return itemstack.getItem() instanceof IStamps;
|
||||
}
|
||||
|
||||
if (slotIndex >= TradeStation.SLOT_BUFFER && slotIndex < TradeStation.SLOT_BUFFER_COUNT) {
|
||||
if (slotIndex >= TradeStation.SLOT_SEND_BUFFER && slotIndex < TradeStation.SLOT_SEND_BUFFER_COUNT) {
|
||||
IInventory inventory = getOrCreateTradeInventory();
|
||||
ItemStack tradegood = inventory.getStackInSlot(TradeStation.SLOT_TRADEGOOD);
|
||||
if(tradegood == null)
|
||||
|
||||
@@ -51,13 +51,15 @@ public class ContainerTrader extends ContainerForestry {
|
||||
for (int j = 0; j < 2; j++)
|
||||
addSlot(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, new Object[] { Items.paper }));
|
||||
|
||||
// Buffer
|
||||
final int bufRows = 6;
|
||||
// Buffers
|
||||
final int bufCols = 5;
|
||||
for (int i = 0; i < bufRows; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
for (int j = 0; j < bufCols; j++)
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18));
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_RECEIVE_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18));
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
for (int j = 0; j < bufCols; j++)
|
||||
addSlot(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + j + i * bufCols, 123 + j * 18, (19 + (18 * 4)) + i * 18));
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++)
|
||||
|
||||
Reference in new issue
Block a user