mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 12:13:54 -07:00
SPIGOT-4339: Add EntityTransformEvent
Thanks klugemonkey for some contributions in https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/351/overview
This commit is contained in:
@@ -1,21 +1,23 @@
|
||||
--- a/net/minecraft/server/EntityVillager.java
|
||||
+++ b/net/minecraft/server/EntityVillager.java
|
||||
@@ -7,6 +7,14 @@
|
||||
@@ -7,6 +7,16 @@
|
||||
import javax.annotation.Nullable;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.entity.CraftVillager;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe;
|
||||
+import org.bukkit.entity.Villager;
|
||||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+import org.bukkit.event.entity.VillagerAcquireTradeEvent;
|
||||
+import org.bukkit.event.entity.VillagerReplenishTradeEvent;
|
||||
+// CraftBukkit end
|
||||
|
||||
public class EntityVillager extends EntityAgeable implements NPC, IMerchant {
|
||||
|
||||
@@ -38,7 +46,7 @@
|
||||
@@ -38,7 +48,7 @@
|
||||
|
||||
public EntityVillager(World world, int i) {
|
||||
super(EntityTypes.VILLAGER, world);
|
||||
@@ -24,7 +26,7 @@
|
||||
this.setProfession(i);
|
||||
this.setSize(0.6F, 1.95F);
|
||||
((Navigation) this.getNavigation()).a(true);
|
||||
@@ -120,7 +128,14 @@
|
||||
@@ -120,7 +130,14 @@
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
if (merchantrecipe.h()) {
|
||||
@@ -40,7 +42,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +147,7 @@
|
||||
@@ -132,7 +149,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +51,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,7 +449,20 @@
|
||||
@@ -434,7 +451,20 @@
|
||||
for (int l = 0; l < k; ++l) {
|
||||
EntityVillager.IMerchantRecipeOption entityvillager_imerchantrecipeoption = aentityvillager_imerchantrecipeoption3[l];
|
||||
|
||||
@@ -71,3 +73,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -574,6 +604,11 @@
|
||||
entitywitch.setCustomNameVisible(this.getCustomNameVisible());
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitywitch, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.addEntity(entitywitch);
|
||||
this.die();
|
||||
}
|
||||
|
Reference in New Issue
Block a user