2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/MobSpawnerAbstract.java
|
|
|
|
+++ b/net/minecraft/server/MobSpawnerAbstract.java
|
2015-06-06 11:33:48 +02:00
|
|
|
@@ -4,6 +4,8 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent; // CraftBukkit
|
|
|
|
+
|
|
|
|
public abstract class MobSpawnerAbstract {
|
|
|
|
|
2015-06-06 11:33:48 +02:00
|
|
|
public int spawnDelay = 20;
|
|
|
|
@@ -24,6 +26,11 @@
|
2014-12-01 11:08:17 +01:00
|
|
|
|
2015-06-06 11:33:48 +02:00
|
|
|
public String getMobName() {
|
2014-12-01 11:08:17 +01:00
|
|
|
if (this.i() == null) {
|
|
|
|
+ // CraftBukkit start - fix NPE
|
|
|
|
+ if (this.mobName == null) {
|
|
|
|
+ this.mobName = "Pig";
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2015-02-26 23:41:06 +01:00
|
|
|
if (this.mobName != null && this.mobName.equals("Minecart")) {
|
2014-12-01 11:08:17 +01:00
|
|
|
this.mobName = "MinecartRideable";
|
|
|
|
}
|
|
|
|
@@ -129,7 +136,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
entity.f(nbttagcompound);
|
|
|
|
if (entity.world != null && flag) {
|
|
|
|
- entity.world.addEntity(entity);
|
|
|
|
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
NBTTagCompound nbttagcompound1;
|
2014-12-01 11:08:17 +01:00
|
|
|
@@ -154,7 +161,7 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
entity2.f(nbttagcompound2);
|
|
|
|
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
|
|
|
|
if (entity.world != null && flag) {
|
|
|
|
- entity.world.addEntity(entity2);
|
|
|
|
+ entity.world.addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
entity1.mount(entity2);
|
2015-02-26 23:41:06 +01:00
|
|
|
@@ -167,7 +174,7 @@
|
|
|
|
((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
- entity.world.addEntity(entity);
|
|
|
|
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
return entity;
|