summaryrefslogtreecommitdiffstats
path: root/nms-patches
diff options
context:
space:
mode:
authornathat890 <nathat890@outlook.com>2018-12-05 09:51:20 +1100
committermd_5 <git@md-5.net>2018-12-05 09:51:45 +1100
commit20fc5bea2c51de8d5239b68d83e878896b8ff505 (patch)
treecd93f48fe1c8d6a33fb2d14f54b328c7611505f9 /nms-patches
parent38e4c013b66d2a870e83fe61b2da6bad608c69af (diff)
downloadcraftbukkit-20fc5bea2c51de8d5239b68d83e878896b8ff505.tar
craftbukkit-20fc5bea2c51de8d5239b68d83e878896b8ff505.tar.gz
craftbukkit-20fc5bea2c51de8d5239b68d83e878896b8ff505.tar.lz
craftbukkit-20fc5bea2c51de8d5239b68d83e878896b8ff505.tar.xz
craftbukkit-20fc5bea2c51de8d5239b68d83e878896b8ff505.zip
Add list of entities to EntityTransformEvent & move die calls
Diffstat (limited to 'nms-patches')
-rw-r--r--nms-patches/EntityMushroomCow.patch12
-rw-r--r--nms-patches/EntityPig.patch19
-rw-r--r--nms-patches/EntitySlime.patch28
-rw-r--r--nms-patches/EntityZombie.patch20
-rw-r--r--nms-patches/EntityZombieVillager.patch15
5 files changed, 57 insertions, 37 deletions
diff --git a/nms-patches/EntityMushroomCow.patch b/nms-patches/EntityMushroomCow.patch
index 3c07a016..9997688a 100644
--- a/nms-patches/EntityMushroomCow.patch
+++ b/nms-patches/EntityMushroomCow.patch
@@ -13,7 +13,7 @@
public class EntityMushroomCow extends EntityCow {
public EntityMushroomCow(World world) {
-@@ -23,6 +29,14 @@
+@@ -23,9 +29,17 @@
return true;
} else if (itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) {
@@ -27,8 +27,12 @@
+ // CraftBukkit end
this.world.addParticle(Particles.u, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D);
if (!this.world.isClientSide) {
- this.die();
-@@ -35,7 +49,12 @@
+- this.die();
++ // this.die(); // CraftBukkit - moved down
+ EntityCow entitycow = new EntityCow(this.world);
+
+ entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+@@ -35,7 +49,14 @@
entitycow.setCustomName(this.getCustomName());
}
@@ -38,6 +42,8 @@
+ return false;
+ }
+ this.world.addEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
++
++ this.die(); // CraftBukkit - from above
+ // CraftBukkit end
for (int i = 0; i < 5; ++i) {
diff --git a/nms-patches/EntityPig.patch b/nms-patches/EntityPig.patch
index 83c89247..7a01790c 100644
--- a/nms-patches/EntityPig.patch
+++ b/nms-patches/EntityPig.patch
@@ -28,31 +28,18 @@
}
@Nullable
-@@ -149,6 +155,12 @@
- if (!this.world.isClientSide && !this.dead) {
- EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
-
-+ // CraftBukkit start
-+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
-+ return;
-+ }
-+ // CraftBukkit end
-+
- entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD));
- entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
- entitypigzombie.setNoAI(this.isNoAI());
-@@ -157,7 +169,13 @@
+@@ -157,7 +163,13 @@
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
}
- this.world.addEntity(entitypigzombie);
+ // CraftBukkit start
-+ if (CraftEventFactory.callEntityTransformEvent(this, entitypigzombie, EntityTransformEvent.TransformReason.LIGHTNING).isCancelled()) {
++ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
+ return;
+ }
-+ // CraftBukkit end
+ // CraftBukkit - added a reason for spawning this creature
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
++ // CraftBukkit end
this.die();
}
}
diff --git a/nms-patches/EntitySlime.patch b/nms-patches/EntitySlime.patch
index c3edb9da..50032f3b 100644
--- a/nms-patches/EntitySlime.patch
+++ b/nms-patches/EntitySlime.patch
@@ -1,10 +1,12 @@
--- a/net/minecraft/server/EntitySlime.java
+++ b/net/minecraft/server/EntitySlime.java
-@@ -1,6 +1,11 @@
+@@ -1,6 +1,13 @@
package net.minecraft.server;
import javax.annotation.Nullable;
+// CraftBukkit start
++import java.util.ArrayList;
++import java.util.List;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTransformEvent;
+import org.bukkit.event.entity.SlimeSplitEvent;
@@ -12,7 +14,7 @@
public class EntitySlime extends EntityInsentient implements IMonster {
-@@ -134,7 +139,7 @@
+@@ -134,7 +141,7 @@
}
public EntityTypes<? extends EntitySlime> P() {
@@ -21,7 +23,7 @@
}
public void die() {
-@@ -143,6 +148,18 @@
+@@ -143,6 +150,19 @@
if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
@@ -35,23 +37,29 @@
+ super.die();
+ return;
+ }
++ List<EntityLiving> slimes = new ArrayList<>(j);
+ // CraftBukkit end
+
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
-@@ -158,7 +175,13 @@
+@@ -158,8 +178,18 @@
entityslime.setSize(i / 2, true);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
- this.world.addEntity(entityslime);
+
-+ // CraftBukkit start
-+ if (CraftEventFactory.callEntityTransformEvent(this, entityslime, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
-+ continue;
-+ }
-+ // CraftBukkit end
-+ this.world.addEntity(entityslime, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
++ slimes.add(entityslime); // CraftBukkit
++ }
++
++ // CraftBukkit start
++ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
++ return;
++ }
++ for (EntityLiving living : slimes) {
++ this.world.addEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
}
++ // CraftBukkit end
}
+ super.die();
diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch
index e0c799e0..b85809fe 100644
--- a/nms-patches/EntityZombie.patch
+++ b/nms-patches/EntityZombie.patch
@@ -96,7 +96,16 @@
}
}
-@@ -372,7 +405,12 @@
+@@ -362,7 +395,7 @@
+ EntityZombieVillager entityzombievillager = new EntityZombieVillager(this.world);
+
+ entityzombievillager.u(entityvillager);
+- this.world.kill(entityvillager);
++ // this.world.kill(entityvillager); // CraftBukkit - moved down
+ entityzombievillager.prepare(this.world.getDamageScaler(new BlockPosition(entityzombievillager)), new EntityZombie.GroupDataZombie(false, null), (NBTTagCompound) null);
+ entityzombievillager.setProfession(entityvillager.getProfession());
+ entityzombievillager.setBaby(entityvillager.isBaby());
+@@ -372,7 +405,13 @@
entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible());
}
@@ -105,12 +114,13 @@
+ if (CraftEventFactory.callEntityTransformEvent(this, entityzombievillager, EntityTransformEvent.TransformReason.INFECTION).isCancelled()) {
+ return;
+ }
-+ // CraftBukkit end
++ this.world.kill(entityvillager); // CraftBukkit - from above
+ this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason
++ // CraftBukkit end
this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0);
}
-@@ -422,7 +460,7 @@
+@@ -422,7 +461,7 @@
entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null, (NBTTagCompound) null);
entitychicken1.s(true);
@@ -119,7 +129,7 @@
this.startRiding(entitychicken1);
}
}
-@@ -495,7 +533,7 @@
+@@ -495,7 +534,7 @@
}
public void die(DamageSource damagesource) {
@@ -128,7 +138,7 @@
if (damagesource.getEntity() instanceof EntityCreeper) {
EntityCreeper entitycreeper = (EntityCreeper) damagesource.getEntity();
-@@ -508,6 +546,7 @@
+@@ -508,6 +547,7 @@
}
}
}
diff --git a/nms-patches/EntityZombieVillager.patch b/nms-patches/EntityZombieVillager.patch
index 895bf789..be60d420 100644
--- a/nms-patches/EntityZombieVillager.patch
+++ b/nms-patches/EntityZombieVillager.patch
@@ -47,7 +47,15 @@
this.world.broadcastEntityEffect(this, (byte) 16);
}
-@@ -123,7 +135,12 @@
+@@ -116,14 +128,20 @@
+ entityvillager.setAgeRaw(-24000);
+ }
+
+- this.world.kill(this);
++ // this.world.kill(this); // CraftBukkit - moved down
+ entityvillager.setNoAI(this.isNoAI());
+ if (this.hasCustomName()) {
+ entityvillager.setCustomName(this.getCustomName());
entityvillager.setCustomNameVisible(this.getCustomNameVisible());
}
@@ -56,12 +64,13 @@
+ if (CraftEventFactory.callEntityTransformEvent(this, entityvillager, EntityTransformEvent.TransformReason.CURED).isCancelled()) {
+ return;
+ }
-+ // CraftBukkit end
++ this.world.kill(this); // CraftBukkit - from above
+ this.world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason
++ // CraftBukkit end
if (this.bD != null) {
EntityHuman entityhuman = this.world.b(this.bD);
-@@ -132,7 +149,7 @@
+@@ -132,7 +150,7 @@
}
}