Search in sources :

Example 1 with PacketUpdateMiscCapToServer

use of com.teamwizardry.wizardry.common.network.capability.PacketUpdateMiscCapToServer in project Wizardry by TeamWizardry.

the class ItemFairyBell method onScroll.

@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void onScroll(MouseEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (player == null)
        return;
    if (Keyboard.isCreated() && event.getDwheel() != 0) {
        for (EnumHand hand : EnumHand.values()) {
            ItemStack stack = player.getHeldItem(hand);
            if (stack.getItem() != ModItems.FAIRY_BELL)
                continue;
            IMiscCapability cap = MiscCapabilityProvider.getCap(Minecraft.getMinecraft().player);
            if (cap == null)
                continue;
            cap.setSelectedFairy(null);
            PacketHandler.NETWORK.sendToServer(new PacketUpdateMiscCapToServer(cap.serializeNBT()));
        }
    }
}
Also used : IMiscCapability(com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) PacketUpdateMiscCapToServer(com.teamwizardry.wizardry.common.network.capability.PacketUpdateMiscCapToServer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

IMiscCapability (com.teamwizardry.wizardry.api.capability.player.miscdata.IMiscCapability)1 PacketUpdateMiscCapToServer (com.teamwizardry.wizardry.common.network.capability.PacketUpdateMiscCapToServer)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1