From e98564f5a8b27a4905663c28ad33f5f68429fa31 Mon Sep 17 00:00:00 2001 From: realguyman Date: Fri, 3 Jun 2022 09:54:36 -0800 Subject: [PATCH] Fix offhand lit variants not extinguishing properly --- .../io/github/realguyman/totally_lit/mixin/ItemMixin.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/realguyman/totally_lit/mixin/ItemMixin.java b/src/main/java/io/github/realguyman/totally_lit/mixin/ItemMixin.java index 05ec495..1aa2382 100644 --- a/src/main/java/io/github/realguyman/totally_lit/mixin/ItemMixin.java +++ b/src/main/java/io/github/realguyman/totally_lit/mixin/ItemMixin.java @@ -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())); + } } } }