mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-16 10:34:53 +00:00
Fix-up of the Mail system
Fixed several crashes and bugs. Tested by sending mail and trading with multiple real accounts and a server. closes #176
This commit is contained in:
1 parent
07afdf63b1
commit
36da6efa91
27 files changed
+470
-258
No files matched your search
@@ -12,7 +12,6 @@ package forestry.mail;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
|
||||
import forestry.api.mail.MailAddress;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
@@ -24,7 +23,7 @@ import forestry.mail.gui.ContainerCatalogue;
|
||||
import forestry.mail.gui.ContainerLetter;
|
||||
import forestry.mail.gui.ContainerTradeName;
|
||||
import forestry.mail.network.PacketPOBoxInfo;
|
||||
import forestry.mail.network.PacketTradeInfo;
|
||||
import forestry.mail.network.PacketLetterInfo;
|
||||
import forestry.plugins.PluginMail;
|
||||
|
||||
public class PacketHandlerMail implements IPacketHandler {
|
||||
@@ -36,10 +35,10 @@ public class PacketHandlerMail implements IPacketHandler {
|
||||
|
||||
PacketUpdate packet;
|
||||
switch (packetID) {
|
||||
case PacketIds.TRADING_INFO:
|
||||
PacketTradeInfo packetT = new PacketTradeInfo();
|
||||
case PacketIds.LETTER_INFO:
|
||||
PacketLetterInfo packetT = new PacketLetterInfo();
|
||||
packetT.readData(data);
|
||||
onTradeInfo(packetT);
|
||||
onLetterInfo(packetT);
|
||||
break;
|
||||
case PacketIds.POBOX_INFO:
|
||||
PacketPOBoxInfo packetP = new PacketPOBoxInfo();
|
||||
@@ -70,11 +69,11 @@ public class PacketHandlerMail implements IPacketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private void onTradeInfo(PacketTradeInfo packet) {
|
||||
private void onLetterInfo(PacketLetterInfo packet) {
|
||||
|
||||
Container container = Proxies.common.getClientInstance().thePlayer.openContainer;
|
||||
if (container instanceof ContainerLetter) {
|
||||
((ContainerLetter) container).handleTradeInfoUpdate(packet);
|
||||
((ContainerLetter) container).handleLetterInfoUpdate(packet);
|
||||
} else if(container instanceof ContainerCatalogue) {
|
||||
((ContainerCatalogue) container).handleTradeInfoUpdate(packet);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user