use of WayofTime.bloodmagic.client.key.IKeybindable in project BloodMagic by WayofTime.
the class KeyProcessor method onMessage.
@Override
public IMessage onMessage(KeyProcessor msg, MessageContext ctx) {
EntityPlayer entityPlayer = ctx.getServerHandler().player;
if (entityPlayer != null) {
ItemStack heldStack = entityPlayer.getHeldItemMainhand();
if (heldStack.getItem() instanceof IKeybindable) {
if (msg.keyId < 0 || msg.keyId >= KeyBindings.values().length) {
return null;
}
KeyBindings key = KeyBindings.values()[msg.keyId];
((IKeybindable) heldStack.getItem()).onKeyPressed(heldStack, entityPlayer, key, msg.showInChat);
}
}
return null;
}
Aggregations