Search in sources :

Example 6 with AmadronOfferCustom

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"));
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) IOException(java.io.IOException) AmadronOfferCustom(pneumaticCraft.common.recipes.AmadronOfferCustom)

Example 7 with AmadronOfferCustom

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);
        }
    }
}
Also used : AmadronOffer(pneumaticCraft.common.recipes.AmadronOffer) AmadronOfferCustom(pneumaticCraft.common.recipes.AmadronOfferCustom)

Aggregations

AmadronOfferCustom (pneumaticCraft.common.recipes.AmadronOfferCustom)7 AmadronOffer (pneumaticCraft.common.recipes.AmadronOffer)3 IOException (java.io.IOException)2 ItemStack (net.minecraft.item.ItemStack)2 ChunkPosition (net.minecraft.world.ChunkPosition)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 ArrayList (java.util.ArrayList)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 NBTTagList (net.minecraft.nbt.NBTTagList)1 PathPoint (net.minecraft.pathfinding.PathPoint)1 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1 World (net.minecraft.world.World)1 GuiLogisticsLiquidFilter (pneumaticCraft.client.gui.semiblock.GuiLogisticsLiquidFilter)1 EntityDrone (pneumaticCraft.common.entity.living.EntityDrone)1 ContainerAmadronAddTrade (pneumaticCraft.common.inventory.ContainerAmadronAddTrade)1 PacketAmadronTradeAdd (pneumaticCraft.common.network.PacketAmadronTradeAdd)1 PacketAmadronTradeRemoved (pneumaticCraft.common.network.PacketAmadronTradeRemoved)1