summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityZombie.patch
diff options
context:
space:
mode:
authornathat890 <nathat890@outlook.com>2018-11-14 14:10:22 +1100
committermd_5 <git@md-5.net>2018-11-14 14:10:22 +1100
commitd2c422f13e5226a81b7fe3f8355922beed2a9cfc (patch)
tree30818363607320b8a215b541292364dcc03932b8 /nms-patches/EntityZombie.patch
parent17ff1e04679d5826f7d574fecc1a97820d5579d1 (diff)
downloadcraftbukkit-d2c422f13e5226a81b7fe3f8355922beed2a9cfc.tar
craftbukkit-d2c422f13e5226a81b7fe3f8355922beed2a9cfc.tar.gz
craftbukkit-d2c422f13e5226a81b7fe3f8355922beed2a9cfc.tar.lz
craftbukkit-d2c422f13e5226a81b7fe3f8355922beed2a9cfc.tar.xz
craftbukkit-d2c422f13e5226a81b7fe3f8355922beed2a9cfc.zip
SPIGOT-4339: Add EntityTransformEvent
Thanks klugemonkey for some contributions in https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/351/overview
Diffstat (limited to 'nms-patches/EntityZombie.patch')
-rw-r--r--nms-patches/EntityZombie.patch34
1 files changed, 23 insertions, 11 deletions
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index 4a6dc06c..e0c799e0 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -1,20 +1,22 @@
--- a/net/minecraft/server/EntityZombie.java
+++ b/net/minecraft/server/EntityZombie.java
-@@ -6,6 +6,13 @@
+@@ -6,6 +6,15 @@
import java.util.UUID;
import javax.annotation.Nullable;
+// CraftBukkit start
++import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
+import org.bukkit.event.entity.EntityCombustEvent;
+import org.bukkit.event.entity.EntityTargetEvent;
++import org.bukkit.event.entity.EntityTransformEvent;
+// CraftBukkit end
+
public class EntityZombie extends EntityMonster {
protected static final IAttribute c = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
-@@ -21,6 +28,7 @@
+@@ -21,6 +30,7 @@
private int bJ;
private float bK;
private float bL;
@@ -22,7 +24,7 @@
public EntityZombie(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
-@@ -143,8 +151,12 @@
+@@ -143,8 +153,12 @@
public void tick() {
if (!this.world.isClientSide) {
@@ -37,7 +39,7 @@
if (this.bJ < 0) {
this.dE();
}
-@@ -182,7 +194,14 @@
+@@ -182,7 +196,14 @@
}
if (flag) {
@@ -53,16 +55,21 @@
}
}
-@@ -221,7 +240,7 @@
+@@ -221,7 +242,12 @@
entityzombie.setCustomNameVisible(this.getCustomNameVisible());
}
- this.world.addEntity(entityzombie);
++ // CraftBukkit start
++ if (CraftEventFactory.callEntityTransformEvent(this, entityzombie, EntityTransformEvent.TransformReason.DROWNED).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.DROWNED); // CraftBukkit - added spawn reason
this.die();
}
}
-@@ -252,8 +271,8 @@
+@@ -252,8 +278,8 @@
if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) {
entityzombie.setPosition((double) i1, (double) j1, (double) k1);
if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a_(entityzombie, entityzombie.getBoundingBox()) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()) && !this.world.containsLiquid(entityzombie.getBoundingBox())) {
@@ -73,7 +80,7 @@
entityzombie.prepare(this.world.getDamageScaler(new BlockPosition(entityzombie)), (GroupDataEntity) null, (NBTTagCompound) null);
this.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
entityzombie.getAttributeInstance(EntityZombie.c).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
-@@ -276,7 +295,14 @@
+@@ -276,7 +302,14 @@
float f = this.world.getDamageScaler(new BlockPosition(this)).b();
if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) {
@@ -89,16 +96,21 @@
}
}
-@@ -372,7 +398,7 @@
+@@ -372,7 +405,12 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
- this.world.addEntity(entityzombievillager);
++ // CraftBukkit start
++ if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
-@@ -422,7 +448,7 @@
+@@ -422,7 +460,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -107,7 +119,7 @@
this.startRiding(entitychicken1);
}
}
-@@ -495,7 +521,7 @@
+@@ -495,7 +533,7 @@
}
public void die(DamageSource damagesource) {
@@ -116,7 +128,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
-@@ -508,6 +534,7 @@
+@@ -508,6 +546,7 @@
}
}
}