use of pneumaticCraft.common.recipes.AmadronOfferCustom in project PneumaticCraft by MineMaarten.
the class PacketAmadronTradeAdd method handleServerSide.
@Override
public void handleServerSide(PacketAmadronTradeAdd message, EntityPlayer player) {
AmadronOfferCustom offer = message.getOffer();
offer.updatePlayerId();
if (AmadronOfferManager.getInstance().hasOffer(offer.copy().invert())) {
player.addChatMessage(new ChatComponentTranslation("message.amadron.duplicateReversedOffer"));
} else if (AmadronOfferManager.getInstance().addStaticOffer(offer)) {
if (AmadronOfferSettings.notifyOfTradeAddition)
NetworkHandler.sendToAll(message);
try {
AmadronOfferStaticConfig.INSTANCE.writeToFile();
} catch (IOException e) {
e.printStackTrace();
}
} else {
player.addChatMessage(new ChatComponentTranslation("message.amadron.duplicateOffer"));
}
}
use of pneumaticCraft.common.recipes.AmadronOfferCustom in project PneumaticCraft by MineMaarten.
the class PacketSyncAmadronOffers method toBytes.
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(offers.size());
for (AmadronOffer offer : offers) {
buf.writeBoolean(offer instanceof AmadronOfferCustom);
writeFluidOrItemStack(offer.getInput(), buf);
writeFluidOrItemStack(offer.getOutput(), buf);
if (offer instanceof AmadronOfferCustom) {
((AmadronOfferCustom) offer).writeToBuf(buf);
}
}
}
Aggregations