mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
fix NPE when iterating over default drops (#10017)
This commit is contained in:
parent
5954b852d8
commit
a3a40ecd2b
1 changed files with 4 additions and 4 deletions
|
@ -188,12 +188,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
lootCheck.run(); // Paper - advancement triggers before destroying items
|
lootCheck.run(); // Paper - advancement triggers before destroying items
|
||||||
|
|
||||||
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||||
- if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ for (Entity.DefaultDrop drop : drops) {
|
+ for (Entity.DefaultDrop drop : drops) {
|
||||||
|
+ if (drop == null) continue;;
|
||||||
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
||||||
+ if (drop == null || stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
if (stack == null || stack.getType() == Material.AIR || stack.getAmount() == 0) continue;
|
||||||
|
|
||||||
- world.dropItem(entity.getLocation(), stack); // Paper - note: dropItem already clones due to this being bukkit -> NMS
|
- world.dropItem(entity.getLocation(), stack); // Paper - note: dropItem already clones due to this being bukkit -> NMS
|
||||||
+ drop.runConsumer(world, entity.getLocation()); // Paper
|
+ drop.runConsumer(world, entity.getLocation()); // Paper
|
||||||
|
@ -216,12 +216,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
victim.newExp = event.getNewExp();
|
victim.newExp = event.getNewExp();
|
||||||
|
|
||||||
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
- for (org.bukkit.inventory.ItemStack stack : event.getDrops()) {
|
||||||
- if (stack == null || stack.getType() == Material.AIR) continue;
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ for (Entity.DefaultDrop drop : drops) {
|
+ for (Entity.DefaultDrop drop : drops) {
|
||||||
|
+ if (drop == null) continue;
|
||||||
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
+ final org.bukkit.inventory.ItemStack stack = drop.stack();
|
||||||
+ if (drop == null || stack == null || stack.getType() == Material.AIR) continue;
|
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
if (stack == null || stack.getType() == Material.AIR) continue;
|
||||||
|
|
||||||
- world.dropItem(entity.getLocation(), stack);
|
- world.dropItem(entity.getLocation(), stack);
|
||||||
+ drop.runConsumer(world, entity.getLocation()); // Paper
|
+ drop.runConsumer(world, entity.getLocation()); // Paper
|
||||||
|
|
Loading…
Reference in a new issue