Skip to content

Commit

Permalink
Fix offhand lit variants not extinguishing properly
Browse files Browse the repository at this point in the history
  • Loading branch information
realguyman committed Jun 3, 2022
1 parent 86f1d15 commit e98564f
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ private void inventoryTick(ItemStack stack, World world, Entity entity, int slot
}

if (chance != null && ((player.isSubmergedInWater() || player.isSwimming()) || (player.isTouchingWater() && world.getRandom().nextInt(100) == 0) || (player.age % 940 == 0 && world.hasRain(player.getCameraBlockPos()) && world.getRandom().nextFloat() < chance))) {
player.getInventory().setStack(slot, new ItemStack(item, stack.getCount()));
ItemStack offhandStack = player.getOffHandStack();

if (offhandStack.isOf(Items.JACK_O_LANTERN) || offhandStack.isOf(Items.LANTERN) || offhandStack.isOf(Items.TORCH) || offhandStack.getItem() instanceof LitTorchItem) {
player.getInventory().offHand.set(0, new ItemStack(item, offhandStack.getCount()));
} else {
player.getInventory().setStack(slot, new ItemStack(item, stack.getCount()));
}
}
}
}
Expand Down

0 comments on commit e98564f

Please sign in to comment.