SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, #1008: Add EntityRemoveEvent
By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
@@ -1,20 +1,42 @@
|
||||
--- a/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
+++ b/net/minecraft/world/entity/vehicle/ChestBoat.java
|
||||
@@ -23,6 +23,13 @@
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -24,6 +24,15 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.List;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
+import org.bukkit.entity.HumanEntity;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.inventory.InventoryHolder;
|
||||
+// CraftBukkit end
|
||||
|
||||
+
|
||||
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
|
||||
|
||||
@@ -238,4 +245,51 @@
|
||||
private static final int CONTAINER_SIZE = 27;
|
||||
@@ -76,11 +85,18 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(entity_removalreason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (!this.level().isClientSide && entity_removalreason.shouldDestroy()) {
|
||||
InventoryUtils.dropContents(this.level(), (Entity) this, (IInventory) this);
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -238,4 +254,51 @@
|
||||
public void stopOpen(EntityHuman entityhuman) {
|
||||
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user