SPIGOT-336, SPIGOT-3366, SPIGOT-5768, SPIGOT-6409, SPIGOT-6861, #1008: Add EntityRemoveEvent

By: DerFrZocker <derrieple@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2024-02-21 20:55:34 +11:00
parent 6dc11b5d28
commit 64cd2b148a
81 changed files with 2037 additions and 475 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -47,6 +47,13 @@
@@ -47,6 +47,14 @@
import net.minecraft.world.phys.Vec3D;
import org.apache.commons.lang3.tuple.Pair;
@@ -8,13 +8,14 @@
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
+import org.bukkit.entity.AbstractVillager;
+import org.bukkit.event.entity.EntityRemoveEvent;
+import org.bukkit.event.entity.VillagerAcquireTradeEvent;
+// CraftBukkit end
+
public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -56,6 +63,7 @@
@@ -56,6 +64,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world);
@@ -22,7 +23,7 @@
}
@Override
@@ -136,7 +144,16 @@
@@ -136,7 +145,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) {
@@ -40,3 +41,12 @@
}
}
@@ -244,7 +262,7 @@
private void maybeDespawn() {
if (this.despawnDelay > 0 && !this.isTrading() && --this.despawnDelay == 0) {
- this.discard();
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
}
}