diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index 4ce4df494..6b5a21f38 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -20,6 +20,7 @@ import forestry.api.mail.ITradeStation; import forestry.api.mail.PostManager; import forestry.api.mail.TradeStationInfo; import forestry.core.config.ForestryItem; +import forestry.core.interfaces.ICrafter; import forestry.core.inventory.InventoryAdapter; import forestry.core.utils.PlayerUtil; import forestry.core.utils.StackUtils; @@ -553,10 +554,10 @@ public class TradeStation extends WorldSavedData implements ITradeStation, ISide return itemStack.getItem() == Items.paper; if (slot >= SLOT_STAMPS_1 && slot < SLOT_STAMPS_1 + SLOT_STAMPS_COUNT) - return IStamps.class.isAssignableFrom(itemStack.getItem().getClass()); + return itemStack.getItem() instanceof IStamps; if (slot >= SLOT_SEND_BUFFER && slot < SLOT_SEND_BUFFER + SLOT_SEND_BUFFER_COUNT) { - ItemStack item = new ItemStack(itemStack.getItem(), 1, itemStack.getItemDamage()); + ItemStack item = StackUtils.createSplitStack(itemStack, 1); return inventory.contains(item, SLOT_TRADEGOOD, SLOT_TRADEGOOD_COUNT); } @@ -603,5 +604,4 @@ public class TradeStation extends WorldSavedData implements ITradeStation, ISide public boolean canExtractItem(int slot, ItemStack itemStack, int side, boolean permission) { return permission && slot >= SLOT_RECEIVE_BUFFER && slot < SLOT_RECEIVE_BUFFER + SLOT_RECEIVE_BUFFER_COUNT; } - } diff --git a/src/main/java/forestry/mail/gui/ContainerTrader.java b/src/main/java/forestry/mail/gui/ContainerTrader.java index 7f67f748c..38fb66134 100755 --- a/src/main/java/forestry/mail/gui/ContainerTrader.java +++ b/src/main/java/forestry/mail/gui/ContainerTrader.java @@ -10,17 +10,20 @@ ******************************************************************************/ package forestry.mail.gui; -import forestry.api.mail.IMailAddress; -import forestry.core.gui.ContainerForestry; -import forestry.core.gui.slots.SlotCustom; -import forestry.mail.TradeStation; -import forestry.mail.gadgets.MachineTrader; -import forestry.mail.items.ItemStamps; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; +import forestry.api.mail.IMailAddress; +import forestry.core.gui.ContainerForestry; +import forestry.core.gui.slots.SlotClosed; +import forestry.core.gui.slots.SlotCustom; +import forestry.core.gui.slots.SlotForestry; +import forestry.mail.TradeStation; +import forestry.mail.gadgets.MachineTrader; +import forestry.mail.items.ItemStamps; + public class ContainerTrader extends ContainerForestry { private final MachineTrader machine; @@ -32,40 +35,40 @@ public class ContainerTrader extends ContainerForestry { IInventory inventory = machine.getOrCreateTradeInventory(); // Trade good - this.addSlotToContainer(new Slot(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109)); + this.addSlotToContainer(new SlotForestry(inventory, TradeStation.SLOT_TRADEGOOD, 78, 109).blockShift()); // Exchange - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - addSlotToContainer(new Slot(inventory, TradeStation.SLOT_EXCHANGE_1 + j + i * 2, 69 + j * 18, 55 + i * 18)); + for (int row = 0; row < 2; row++) { + for (int col = 0; col < 2; col++) { + addSlotToContainer(new SlotForestry(inventory, TradeStation.SLOT_EXCHANGE_1 + col + row * 2, 69 + col * 18, 55 + row * 18).blockShift()); } } // Stamps - for (int i = 0; i < 2; i++) { - for (int j = 0; j < 2; j++) { - addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + j + i * 2, 15 + j * 18, 37 + i * 18, ItemStamps.class)); + for (int row = 0; row < 2; row++) { + for (int col = 0; col < 2; col++) { + addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_STAMPS_1 + col + row * 2, 15 + col * 18, 37 + row * 18, ItemStamps.class)); } } // Letters - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 2; j++) { - addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + j + i * 2, 15 + j * 18, 73 + i * 18, Items.paper)); + for (int row = 0; row < 3; row++) { + for (int col = 0; col < 2; col++) { + addSlotToContainer(new SlotCustom(inventory, TradeStation.SLOT_LETTERS_1 + col + row * 2, 15 + col * 18, 73 + row * 18, Items.paper)); } } // Buffers final int bufCols = 5; - for (int i = 0; i < 3; i++) { - for (int j = 0; j < bufCols; j++) { - addSlotToContainer(new Slot(inventory, TradeStation.SLOT_RECEIVE_BUFFER + j + i * bufCols, 123 + j * 18, 19 + i * 18)); + for (int row = 0; row < 3; row++) { + for (int col = 0; col < bufCols; col++) { + addSlotToContainer(new SlotClosed(inventory, TradeStation.SLOT_RECEIVE_BUFFER + col + row * bufCols, 123 + col * 18, 19 + row * 18)); } } - for (int i = 0; i < 2; i++) { - for (int j = 0; j < bufCols; j++) { - addSlotToContainer(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + j + i * bufCols, 123 + j * 18, (19 + (18 * 4)) + i * 18)); + for (int row = 0; row < 2; row++) { + for (int col = 0; col < bufCols; col++) { + addSlotToContainer(new Slot(inventory, TradeStation.SLOT_SEND_BUFFER + col + row * bufCols, 123 + col * 18, (19 + (18 * 4)) + row * 18)); } } @@ -79,11 +82,6 @@ public class ContainerTrader extends ContainerForestry { for (int i = 0; i < 9; i++) { addSlotToContainer(new Slot(player, i, 33 + i * 18, 196)); } - - } - - public boolean isLinked() { - return machine.isLinked(); } public IMailAddress getAddress() {