Fix lexicon share crashing if you don't have the lexicon in main hand

This commit is contained in:
Hubry committed 2019-12-08 19:50:19 +01:00
1 parent 6666cf1e23
commit 346581e23d
1 file changed
+7 -3
@@ -192,12 +192,16 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int idk, boolean something) {
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean selected) {
int ticks = getQueueTicks(stack);
if(ticks > 0 && entity instanceof EntityPlayer) {
skipSound = ticks < 5;
if(ticks == 1)
onItemRightClick(world, (EntityPlayer) entity, EnumHand.MAIN_HAND);
if(ticks == 1) {
if(selected)
onItemRightClick(world, (EntityPlayer) entity, EnumHand.MAIN_HAND);
else if(stack == ((EntityPlayer) entity).getHeldItemOffhand())
onItemRightClick(world, (EntityPlayer) entity, EnumHand.OFF_HAND);
}
setQueueTicks(stack, ticks - 1);
}