Search in sources :

Example 1 with PacketDataSerializer

use of net.minecraft.server.v1_11_R1.PacketDataSerializer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeList_v1_10_R1 method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    try {
        PacketDataSerializer serializer = new PacketDataSerializer(Unpooled.buffer());
        serializer.a("MC|TrList");
        serializer.writeInt(container);
        serializer.writeByte((byte) (tradeOffers.size() & 255));
        for (TradeOffer tradeOffer : tradeOffers) {
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getFirstCost()));
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getProduct()));
            boolean hasSecondCost = tradeOffer.hasSecondCost();
            serializer.writeBoolean(hasSecondCost);
            if (hasSecondCost) {
                serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getSecondCost()));
            }
            serializer.writeBoolean(tradeOffer.isUsedMaxTimes());
            serializer.writeInt(tradeOffer.getCurrentUses());
            serializer.writeInt(tradeOffer.getMaxUses());
        }
        internal.a(serializer);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : PacketDataSerializer(net.minecraft.server.v1_10_R1.PacketDataSerializer) TradeOffer(net.aufdemrand.denizen.nms.util.TradeOffer)

Example 2 with PacketDataSerializer

use of net.minecraft.server.v1_11_R1.PacketDataSerializer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeList_v1_11_R1 method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    try {
        PacketDataSerializer serializer = new PacketDataSerializer(Unpooled.buffer());
        serializer.a("MC|TrList");
        serializer.writeInt(container);
        serializer.writeByte((byte) (tradeOffers.size() & 255));
        for (TradeOffer tradeOffer : tradeOffers) {
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getFirstCost()));
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getProduct()));
            boolean hasSecondCost = tradeOffer.hasSecondCost();
            serializer.writeBoolean(hasSecondCost);
            if (hasSecondCost) {
                serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getSecondCost()));
            }
            serializer.writeBoolean(tradeOffer.isUsedMaxTimes());
            serializer.writeInt(tradeOffer.getCurrentUses());
            serializer.writeInt(tradeOffer.getMaxUses());
        }
        internal.a(serializer);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : PacketDataSerializer(net.minecraft.server.v1_11_R1.PacketDataSerializer) TradeOffer(net.aufdemrand.denizen.nms.util.TradeOffer)

Example 3 with PacketDataSerializer

use of net.minecraft.server.v1_11_R1.PacketDataSerializer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeList_v1_8_R3 method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    try {
        PacketDataSerializer serializer = new PacketDataSerializer(Unpooled.buffer());
        serializer.a("MC|TrList");
        serializer.writeInt(container);
        serializer.writeByte((byte) (tradeOffers.size() & 255));
        for (TradeOffer tradeOffer : tradeOffers) {
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getFirstCost()));
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getProduct()));
            boolean hasSecondCost = tradeOffer.hasSecondCost();
            serializer.writeBoolean(hasSecondCost);
            if (hasSecondCost) {
                serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getSecondCost()));
            }
            serializer.writeBoolean(tradeOffer.isUsedMaxTimes());
            serializer.writeInt(tradeOffer.getCurrentUses());
            serializer.writeInt(tradeOffer.getMaxUses());
        }
        internal.a(serializer);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : PacketDataSerializer(net.minecraft.server.v1_8_R3.PacketDataSerializer) TradeOffer(net.aufdemrand.denizen.nms.util.TradeOffer)

Example 4 with PacketDataSerializer

use of net.minecraft.server.v1_11_R1.PacketDataSerializer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeList_v1_9_R2 method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    try {
        PacketDataSerializer serializer = new PacketDataSerializer(Unpooled.buffer());
        serializer.a("MC|TrList");
        serializer.writeInt(container);
        serializer.writeByte((byte) (tradeOffers.size() & 255));
        for (TradeOffer tradeOffer : tradeOffers) {
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getFirstCost()));
            serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getProduct()));
            boolean hasSecondCost = tradeOffer.hasSecondCost();
            serializer.writeBoolean(hasSecondCost);
            if (hasSecondCost) {
                serializer.a(CraftItemStack.asNMSCopy(tradeOffer.getSecondCost()));
            }
            serializer.writeBoolean(tradeOffer.isUsedMaxTimes());
            serializer.writeInt(tradeOffer.getCurrentUses());
            serializer.writeInt(tradeOffer.getMaxUses());
        }
        internal.a(serializer);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : PacketDataSerializer(net.minecraft.server.v1_9_R2.PacketDataSerializer) TradeOffer(net.aufdemrand.denizen.nms.util.TradeOffer)

Aggregations

TradeOffer (net.aufdemrand.denizen.nms.util.TradeOffer)4 PacketDataSerializer (net.minecraft.server.v1_10_R1.PacketDataSerializer)1 PacketDataSerializer (net.minecraft.server.v1_11_R1.PacketDataSerializer)1 PacketDataSerializer (net.minecraft.server.v1_8_R3.PacketDataSerializer)1 PacketDataSerializer (net.minecraft.server.v1_9_R2.PacketDataSerializer)1