public void doKeyBindingAction(EntityPlayer entityPlayer, ItemStack itemStack, Key key)
{
if (key != Key.UNKNOWN)
{
NBTTagCompound playerCustomData = EntityHelper.getCustomEntityData(entityPlayer);
ChalkSettings chalkSettings = new ChalkSettings();
chalkSettings.readFromNBT(playerCustomData);
if (key == Key.CHARGE)
{
if (!entityPlayer.isSneaking())
{
chalkSettings.incrementSize();
}
else
{
chalkSettings.decrementSize();
}
}
else if (key == Key.TOGGLE)
{
if (!entityPlayer.isSneaking())
{
chalkSettings.incrementIndex();
}
else
{
chalkSettings.decrementIndex();
}
}
else if (key == Key.RELEASE)
{
if (!entityPlayer.isSneaking())
{
chalkSettings.rotateClockwise();
}
else
{
chalkSettings.rotateCounterClockwise();
}
}
chalkSettings.writeToNBT(playerCustomData);
EntityHelper.saveCustomEntityData(entityPlayer, playerCustomData);
PacketHandler.INSTANCE.sendTo(new MessageChalkSettings(chalkSettings), (EntityPlayerMP) entityPlayer);
}
}