Fix server crash with holding sigil keybind (#915)

@Arcaratus, poking because this will break BA again. I separated things into new classes.
This commit is contained in:
Nicholas Ignoffo 2016-09-13 16:09:45 -07:00
parent e9549fd9db
commit d1f98be462
7 changed files with 143 additions and 134 deletions

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.network;
import WayofTime.bloodmagic.client.KeyBindingBloodMagic;
import WayofTime.bloodmagic.client.IKeybindable;
import WayofTime.bloodmagic.client.key.IKeybindable;
import WayofTime.bloodmagic.client.key.KeyBindings;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -18,7 +18,7 @@ public class KeyProcessor implements IMessage, IMessageHandler<KeyProcessor, IMe
{
}
public KeyProcessor(KeyBindingBloodMagic.KeyBindings key, boolean showInChat)
public KeyProcessor(KeyBindings key, boolean showInChat)
{
this.keyId = key.ordinal();
this.showInChat = showInChat;
@ -48,11 +48,11 @@ public class KeyProcessor implements IMessage, IMessageHandler<KeyProcessor, IMe
ItemStack heldStack = entityPlayer.getHeldItemMainhand();
if (heldStack.getItem() instanceof IKeybindable)
{
if (msg.keyId < 0 || msg.keyId >= KeyBindingBloodMagic.KeyBindings.values().length)
if (msg.keyId < 0 || msg.keyId >= KeyBindings.values().length)
{
return null;
}
KeyBindingBloodMagic.KeyBindings key = KeyBindingBloodMagic.KeyBindings.values()[msg.keyId];
KeyBindings key = KeyBindings.values()[msg.keyId];
((IKeybindable) heldStack.getItem()).onKeyPressed(heldStack, entityPlayer, key, msg.showInChat);
}
}