mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-28 15:36:18 +00:00
Fix #641 Item Inventory Dupe Bug. Refactor Inventories
This commit is contained in:
1 parent
6b824f47cd
commit
93a6c77eba
82 files changed
+719
-1258
No files matched your search
@@ -35,7 +35,6 @@ import forestry.core.network.PacketPayload;
|
||||
import forestry.core.network.PacketUpdate;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.mail.Letter;
|
||||
import forestry.mail.items.ItemLetter;
|
||||
import forestry.mail.items.ItemLetter.LetterInventory;
|
||||
import forestry.mail.network.PacketLetterInfo;
|
||||
|
||||
@@ -45,13 +44,7 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
|
||||
private TradeStationInfo tradeInfo = null;
|
||||
|
||||
public ContainerLetter(EntityPlayer player, LetterInventory inventory) {
|
||||
super(inventory);
|
||||
|
||||
// Rip open delivered mails
|
||||
if (Proxies.common.isSimulating(player.worldObj) && inventory.getLetter().isProcessed() && inventory.parent != null
|
||||
&& ItemLetter.getState(inventory.parent.getItemDamage()) < 2) {
|
||||
inventory.parent.setItemDamage(ItemLetter.encodeMeta(2, ItemLetter.getSize(inventory.parent.getItemDamage())));
|
||||
}
|
||||
super(inventory, player.inventory, 17, 145);
|
||||
|
||||
// Init slots
|
||||
|
||||
@@ -67,16 +60,12 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
|
||||
}
|
||||
}
|
||||
|
||||
// Player inventory
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSecuredSlot(player.inventory, j + i * 9 + 9, 17 + j * 18, 145 + i * 18);
|
||||
// Rip open delivered mails
|
||||
if (Proxies.common.isSimulating(player.worldObj)) {
|
||||
if (inventory.getLetter().isProcessed()) {
|
||||
inventory.onLetterOpened();
|
||||
}
|
||||
}
|
||||
// Player hotbar
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSecuredSlot(player.inventory, i, 17 + i * 18, 203);
|
||||
}
|
||||
|
||||
// Set recipient type
|
||||
ILetter letter = inventory.getLetter();
|
||||
@@ -99,6 +88,8 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
|
||||
}
|
||||
}
|
||||
|
||||
inventory.onContainerClosed();
|
||||
|
||||
super.onContainerClosed(entityplayer);
|
||||
}
|
||||
|
||||
@@ -200,7 +191,8 @@ public class ContainerLetter extends ContainerItemInventory<LetterInventory> {
|
||||
}
|
||||
|
||||
public void handleSetText(PacketUpdate packet) {
|
||||
getLetter().setText(packet.payload.stringPayload[0]);
|
||||
String text = packet.payload.stringPayload[0];
|
||||
getLetter().setText(text);
|
||||
}
|
||||
|
||||
/* Managing Trade info */
|
||||
|
||||
Reference in new issue
Block a user