Disallow people spawning invalid entities using monster eggs. Thanks to md-5 for the PR.

This commit is contained in:
Nathan Adams
2012-01-15 09:45:16 +00:00
parent 390a79e098
commit 25050e38eb
2 changed files with 8 additions and 5 deletions

View File

@@ -9,7 +9,7 @@ public class ItemMonsterEgg extends Item {
}
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (world.isStatic) {
if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63) { // CraftBukkit
return true;
} else {
i += Facing.b[l];
@@ -17,7 +17,7 @@ public class ItemMonsterEgg extends Item {
k += Facing.d[l];
Entity entity = EntityTypes.a(itemstack.getData(), world);
if (entity != null) {
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -29,4 +29,4 @@ public class ItemMonsterEgg extends Item {
return true;
}
}
}
}