mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 23:03:18 +00:00
Fix #181: Letters sent to yourself disappear in Single Player
This commit is contained in:
1 parent
d459856852
commit
7f50c7e929
4 files changed
+17
-40
No files matched your search
@@ -27,6 +27,9 @@ import forestry.plugins.PluginMail;
|
||||
|
||||
public class ContainerMailbox extends ContainerForestry {
|
||||
|
||||
public static final short SLOT_LETTERS = 0;
|
||||
public static final short SLOT_LETTERS_COUNT = 7 * 12;
|
||||
|
||||
MachineMailbox mailbox;
|
||||
POBox mailinventory;
|
||||
|
||||
@@ -36,7 +39,7 @@ public class ContainerMailbox extends ContainerForestry {
|
||||
// Mailbox contents
|
||||
this.mailbox = tile;
|
||||
|
||||
IInventory inv = mailbox.getOrCreateMailInventory(player.player);
|
||||
IInventory inv = mailbox.getOrCreateMailInventory(player.player.worldObj, player.player.getGameProfile());
|
||||
if (inv instanceof POBox)
|
||||
mailinventory = (POBox) inv;
|
||||
|
||||
@@ -58,9 +61,11 @@ public class ContainerMailbox extends ContainerForestry {
|
||||
public ItemStack slotClick(int slotIndex, int button, int par3, EntityPlayer player) {
|
||||
ItemStack stack = super.slotClick(slotIndex, button, par3, player);
|
||||
|
||||
if (Proxies.common.isSimulating(player.worldObj) && mailinventory != null) {
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(mailbox.getOwnerProfile());
|
||||
PluginMail.proxy.setPOBoxInfo(mailbox.getWorldObj(), address, mailinventory.getPOBoxInfo());
|
||||
if (slotIndex >= SLOT_LETTERS && slotIndex < SLOT_LETTERS + SLOT_LETTERS_COUNT) {
|
||||
if (Proxies.common.isSimulating(player.worldObj) && mailinventory != null) {
|
||||
IMailAddress address = PostManager.postRegistry.getMailAddress(player.getGameProfile());
|
||||
PluginMail.proxy.setPOBoxInfo(mailbox.getWorldObj(), address, mailinventory.getPOBoxInfo());
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
|
||||
Reference in new issue
Block a user