Search in sources :

Example 1 with SPacketAdd

use of kingdoms.server.handlers.packets.server.SPacketAdd in project Tale-of-Kingdoms by Ivasik78.

the class GuiFoodKeeper method actionPerformed.

@Override
public void actionPerformed(GuiButton button) {
    switch(button.id) {
        case 1:
            if (this.freeBread) {
                this.mc.displayGuiScreen(null);
                NetworkHandler.INSTANCE.sendToServer(new SPacketAdd(new ItemStack(Items.bread), 1, "gui.farmer.take"));
                this.freeBread = false;
            } else if (!this.world.isRemote) {
                this.player.addChatMessage(new ChatComponentTranslation("gui.farmer.have"));
            }
            break;
        case 2:
            this.mc.displayGuiScreen(null);
            break;
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ItemStack(net.minecraft.item.ItemStack) SPacketAdd(kingdoms.server.handlers.packets.server.SPacketAdd)

Example 2 with SPacketAdd

use of kingdoms.server.handlers.packets.server.SPacketAdd in project Tale-of-Kingdoms by Ivasik78.

the class GuiFisher method actionPerformed.

@Override
public void actionPerformed(final GuiButton guibutton) {
    if (guibutton.id == 1) {
        this.mc.displayGuiScreen(null);
        NetworkHandler.INSTANCE.sendToServer(new SPacketAdd(new ItemStack(Items.fishing_rod), 1, "npc.fisher.dialog.fishingRod"));
    } else if (guibutton.id == 2) {
        this.mc.displayGuiScreen(null);
    }
}
Also used : ItemStack(net.minecraft.item.ItemStack) SPacketAdd(kingdoms.server.handlers.packets.server.SPacketAdd)

Aggregations

SPacketAdd (kingdoms.server.handlers.packets.server.SPacketAdd)2 ItemStack (net.minecraft.item.ItemStack)2 ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)1