2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityPig.java
|
|
|
|
+++ b/net/minecraft/server/EntityPig.java
|
2018-11-14 04:10:22 +01:00
|
|
|
@@ -2,6 +2,11 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-11-14 04:10:22 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
|
|
|
+// CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
public class EntityPig extends EntityAnimal {
|
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
private static final DataWatcherObject<Boolean> bC = DataWatcher.a(EntityPig.class, DataWatcherRegistry.i);
|
2018-11-14 04:10:22 +01:00
|
|
|
@@ -118,13 +123,14 @@
|
2017-01-24 03:39:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void die(DamageSource damagesource) {
|
|
|
|
- super.die(damagesource);
|
|
|
|
+ // super.die(damagesource); // CraftBukkit - Moved to end
|
|
|
|
if (!this.world.isClientSide) {
|
|
|
|
if (this.hasSaddle()) {
|
2018-07-15 02:00:00 +02:00
|
|
|
this.a((IMaterial) Items.SADDLE);
|
2017-01-24 03:39:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
+ super.die(damagesource); // CraftBukkit - Moved from above
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
2018-12-04 23:51:20 +01:00
|
|
|
@@ -157,7 +163,13 @@
|
2015-02-26 23:41:06 +01:00
|
|
|
entitypigzombie.setCustomNameVisible(this.getCustomNameVisible());
|
|
|
|
}
|
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
- this.world.addEntity(entitypigzombie);
|
2018-11-14 04:10:22 +01:00
|
|
|
+ // CraftBukkit start
|
2018-12-04 23:51:20 +01:00
|
|
|
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
2018-11-14 04:10:22 +01:00
|
|
|
+ return;
|
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit - added a reason for spawning this creature
|
|
|
|
+ this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
2018-12-04 23:51:20 +01:00
|
|
|
+ // CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
this.die();
|
|
|
|
}
|
|
|
|
}
|