Search in sources :

Example 11 with ItemSpellBook

use of am2.items.ItemSpellBook in project ArsMagica2 by Mithion.

the class AMPacketProcessorServer method handleSpellBookChangeActiveSlot.

private void handleSpellBookChangeActiveSlot(byte[] data, EntityPlayerMP player) {
    AMDataReader rdr = new AMDataReader(data, false);
    byte subID = rdr.getByte();
    int entityID = rdr.getInt();
    int inventorySlot = rdr.getInt();
    ItemStack stack = player.inventory.getStackInSlot(inventorySlot);
    if (stack == null || !(stack.getItem() instanceof ItemSpellBook))
        return;
    int newIndex = 0;
    if (subID == ItemSpellBook.ID_NEXT_SPELL)
        newIndex = ItemsCommonProxy.spellBook.SetNextSlot(stack);
    else if (subID == ItemSpellBook.ID_PREV_SPELL)
        newIndex = ItemsCommonProxy.spellBook.SetPrevSlot(stack);
    else
        return;
}
Also used : ItemStack(net.minecraft.item.ItemStack) ItemSpellBook(am2.items.ItemSpellBook)

Aggregations

ItemStack (net.minecraft.item.ItemStack)11 ItemSpellBook (am2.items.ItemSpellBook)8 IKeystoneLockable (am2.api.blocks.IKeystoneLockable)2 AMVector2 (am2.api.math.AMVector2)2 ExtendedProperties (am2.playerextensions.ExtendedProperties)2 TileEntity (net.minecraft.tileentity.TileEntity)2 ItemSpellBase (am2.api.spell.ItemSpellBase)1 Affinity (am2.api.spell.enums.Affinity)1 AuraCustomizationMenu (am2.guis.AuraCustomizationMenu)1 IBoundItem (am2.items.IBoundItem)1 AMDataWriter (am2.network.AMDataWriter)1 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 GuiInventory (net.minecraft.client.gui.inventory.GuiInventory)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 IIcon (net.minecraft.util.IIcon)1 World (net.minecraft.world.World)1