From 390a79e098903371a271f9bc68fe711915caf9e7 Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Sun, 15 Jan 2012 09:41:41 +0000 Subject: [PATCH] Added ItemMonsterEgg.java for diff visibility --- .../net/minecraft/server/ItemMonsterEgg.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/main/java/net/minecraft/server/ItemMonsterEgg.java diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java new file mode 100644 index 0000000000..c4bd8644ca --- /dev/null +++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java @@ -0,0 +1,32 @@ +package net.minecraft.server; + +public class ItemMonsterEgg extends Item { + + public ItemMonsterEgg(int i) { + super(i); + this.e(1); + this.a(true); + } + + public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { + if (world.isStatic) { + return true; + } else { + i += Facing.b[l]; + j += Facing.c[l]; + k += Facing.d[l]; + Entity entity = EntityTypes.a(itemstack.getData(), world); + + if (entity != null) { + if (!entityhuman.abilities.canInstantlyBuild) { + --itemstack.count; + } + + entity.setPositionRotation((double) i + 0.5D, (double) j, (double) k + 0.5D, 0.0F, 0.0F); + world.addEntity(entity); + } + + return true; + } + } +}