Skip to content

Commit

Permalink
Fix lit items cloning unlit items to hotbar
Browse files Browse the repository at this point in the history
  • Loading branch information
realguyman committed Oct 28, 2024
1 parent 6527345 commit 6e6146e
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ private boolean shouldExtinguish(float chance, Block lit, PlayerEntity player, W

@Unique
private void extinguish(Float chance, Block lit, Block unlit, ItemStack stack, PlayerEntity player, int slot, World world) {
if (!shouldExtinguish(chance, lit, player, world) || !stack.isOf(lit.asItem())) {
if (!shouldExtinguish(chance, lit, player, world)) {
return;
}

if (player.getOffHandStack().isOf(lit.asItem())) {
player.getInventory().offHand.set(0, new ItemStack(unlit.asItem(), player.getOffHandStack().getCount()));
} else {
if (player.getInventory().getStack(40).isOf(lit.asItem())) {
player.getInventory().setStack(40, new ItemStack(unlit.asItem(), stack.getCount()));
}

if (player.getInventory().getStack(slot).isOf(lit.asItem())) {
player.getInventory().setStack(slot, new ItemStack(unlit.asItem(), stack.getCount()));
}
}
Expand Down

0 comments on commit 6e6146e

Please sign in to comment.