Bulk bugfixes for itemstack damage API (#11063)
A general set of bugfixes for itemstack damage related logic. 1. Prevent NPE when calling deprecated ItemStack#getMaxItemUseDuration() 2. Do not apply enchantments when damaging items via API 3. Do not error when passing a null equipment slot to hurtAndBreak 4. Correctly call PlayerItemBreakEvent
This commit is contained in:
@@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (entity == null && handle.is(Items.CROSSBOW)) {
|
||||
+ throw new UnsupportedOperationException("This item requires an entity to determine the max use duration");
|
||||
+ }
|
||||
+ return handle.getUseDuration(((CraftLivingEntity) entity).getHandle());
|
||||
+ return handle.getUseDuration(entity != null ? ((CraftLivingEntity) entity).getHandle() : null);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
||||
Reference in New Issue
Block a user