use of forestry.mail.network.PacketLetterInfo in project ForestryMC by ForestryMC.
the class PacketHandlerMail method onPacketData.
@Override
public boolean onPacketData(int packetID, DataInputStream data, EntityPlayer player) throws IOException {
PacketUpdate packet;
switch(packetID) {
case PacketIds.LETTER_INFO:
PacketLetterInfo packetT = new PacketLetterInfo();
packetT.readData(data);
onLetterInfo(packetT);
return true;
case PacketIds.POBOX_INFO:
PacketPOBoxInfo packetP = new PacketPOBoxInfo();
packetP.readData(data);
onPOBoxInfo(packetP);
return true;
case PacketIds.LETTER_RECIPIENT:
packet = new PacketUpdate();
packet.readData(data);
onLetterRecipient(player, packet);
return true;
case PacketIds.LETTER_TEXT:
packet = new PacketUpdate();
packet.readData(data);
onLetterText(player, packet);
return true;
case PacketIds.TRADING_ADDRESS_SET:
packet = new PacketUpdate();
packet.readData(data);
onAddressSet(player, packet);
return true;
case PacketIds.POBOX_INFO_REQUEST:
onPOBoxInfoRequest(player);
return true;
}
return false;
}
use of forestry.mail.network.PacketLetterInfo in project ForestryMC by ForestryMC.
the class ContainerCatalogue method detectAndSendChanges.
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (needsSynch) {
for (Object crafter1 : crafters) {
ICrafting crafter = (ICrafting) crafter1;
crafter.sendProgressBarUpdate(this, 0, stationIndex);
crafter.sendProgressBarUpdate(this, 1, stations.size());
crafter.sendProgressBarUpdate(this, 2, currentFilter);
}
Proxies.net.sendToPlayer(new PacketLetterInfo(PacketIds.LETTER_INFO, EnumAddressee.TRADER, currentTrade, null), player);
needsSynch = false;
}
}
use of forestry.mail.network.PacketLetterInfo in project ForestryMC by ForestryMC.
the class ContainerLetter method handleSetRecipient.
public void handleSetRecipient(EntityPlayer player, PacketUpdate packet) {
String recipientName = packet.payload.stringPayload[0];
String typeName = packet.payload.stringPayload[1];
EnumAddressee type = EnumAddressee.fromString(typeName);
IMailAddress recipient;
if (type == EnumAddressee.PLAYER) {
GameProfile gameProfile = MinecraftServer.getServer().func_152358_ax().func_152655_a(recipientName);
if (gameProfile == null) {
gameProfile = new GameProfile(new UUID(0, 0), recipientName);
}
recipient = PostManager.postRegistry.getMailAddress(gameProfile);
} else if (type == EnumAddressee.TRADER) {
recipient = PostManager.postRegistry.getMailAddress(recipientName);
} else {
return;
}
getLetter().setRecipient(recipient);
// Update the trading info
if (recipient == null || recipient.isTrader()) {
updateTradeInfo(player.worldObj, recipient);
}
// Update info on client
Proxies.net.sendToPlayer(new PacketLetterInfo(PacketIds.LETTER_INFO, type, tradeInfo, recipient), player);
}
Aggregations