Paper/nms-patches/ItemMonsterEgg.patch

35 lines
1.8 KiB
Diff
Raw Normal View History

2014-12-03 11:52:18 +01:00
--- ../work/decompile-8eb82bde//net/minecraft/server/ItemMonsterEgg.java 2014-12-03 10:52:09.804159084 +0000
+++ src/main/java/net/minecraft/server/ItemMonsterEgg.java 2014-12-03 10:51:53.380159449 +0000
@@ -19,7 +19,8 @@
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) {
- if (world.isStatic) {
+ // CraftBukkit - check ItemStack data
+ if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63 || itemstack.getData() == 64) {
return true;
} else if (!entityhuman.a(blockposition.shift(enumdirection), enumdirection, itemstack)) {
return false;
@@ -109,6 +110,12 @@
}
public static Entity a(World world, int i, double d0, double d1, double d2) {
+ // CraftBukkit start - delegate to spawnCreature
+ return spawnCreature(world, i, d0, d1, d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
+ }
+
+ public static Entity spawnCreature(World world, int i, double d0, double d1, double d2, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
+ // CraftBukkit end
if (!EntityTypes.eggInfo.containsKey(Integer.valueOf(i))) {
return null;
} else {
2014-12-03 11:52:18 +01:00
@@ -123,7 +130,7 @@
entityinsentient.aI = entityinsentient.yaw;
entityinsentient.aG = entityinsentient.yaw;
entityinsentient.prepare(world.E(new BlockPosition(entityinsentient)), (GroupDataEntity) null);
- world.addEntity(entity);
+ world.addEntity(entity, spawnReason); // CraftBukkit
entityinsentient.x();
}
}