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;
}
Aggregations