neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.1k stars 161 forks source link

If using Shield on enemy. Shield is gone #211

Closed baguchan closed 9 months ago

baguchan commented 9 months ago

Minecraft Version: 1.20.2

NeoForge Version: 20.2.3

Logs: none

Steps to Reproduce:

  1. Using shield and guard from enemy
  2. Sheild is gone. even max durability

Description of issue: This happened when I was using a shield when I was making modding on neoforge 1.20.2.

sciwhiz12 commented 9 months ago

The issue is caused by a misapplied patch in Player, causing a call to stopUsingItem() (which clears the currently-using item) whether or not the shield actually broke.

(Take note of the indentation: the code is supposed to be in the now-compacted lambda for hurtAndBreak.) https://github.com/neoforged/NeoForge/blob/3e5d9b00241fdff90afbcc6580e0d8cd630a5421/patches/net/minecraft/world/entity/player/Player.java.patch#L142-L150