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:
parent
e9549fd9db
commit
d1f98be462
7 changed files with 143 additions and 134 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue