mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Add missing EntityDropItemEvent calls (#5674)
This commit is contained in:
parent
6a3d83f459
commit
6e7a5755b8
1 changed files with 59 additions and 0 deletions
|
@ -0,0 +1,59 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Tue, 20 Jul 2021 21:35:47 -0700
|
||||
Subject: [PATCH] Add various missing EntityDropItemEvent calls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // Paper start
|
||||
+ return this.spawnAtLocation(entityitem);
|
||||
+ }
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ public ItemEntity spawnAtLocation(ItemEntity entityitem) {
|
||||
+ {
|
||||
+ // Paper end
|
||||
// CraftBukkit start
|
||||
EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -0,0 +0,0 @@ public class Dolphin extends WaterAnimal {
|
||||
float f2 = 0.02F * Dolphin.this.random.nextFloat();
|
||||
|
||||
entityitem.setDeltaMovement((double) (0.3F * -Mth.sin(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.cos(f1) * f2), (double) (0.3F * Mth.sin(Dolphin.this.getXRot() * 0.017453292F) * 1.5F), (double) (0.3F * Mth.cos(Dolphin.this.getYRot() * 0.017453292F) * Mth.cos(Dolphin.this.getXRot() * 0.017453292F) + Mth.sin(f1) * f2));
|
||||
- Dolphin.this.level.addFreshEntity(entityitem);
|
||||
+ Dolphin.this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
|
||||
}
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Fox.java b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Fox.java
|
||||
@@ -0,0 +0,0 @@ public class Fox extends Animal {
|
||||
entityitem.setPickUpDelay(40);
|
||||
entityitem.setThrower(this.getUUID());
|
||||
this.playSound(SoundEvents.FOX_SPIT, 1.0F, 1.0F);
|
||||
- this.level.addFreshEntity(entityitem);
|
||||
+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
|
||||
}
|
||||
}
|
||||
|
||||
private void dropItemStack(ItemStack stack) {
|
||||
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY(), this.getZ(), stack);
|
||||
|
||||
- this.level.addFreshEntity(entityitem);
|
||||
+ this.spawnAtLocation(entityitem); // Paper - call EntityDropItemEvent
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in a new issue