diff options
author | Thinkofdeath <thinkofdeath@spigotmc.org> | 2014-11-26 08:32:16 +1100 |
---|---|---|
committer | md_5 <git@md-5.net> | 2014-11-28 17:16:30 +1100 |
commit | 24557bc2b37deb6a0edf497d547471832457b1dd (patch) | |
tree | c560572889a3b0b34964a0cddb35dc87fda3c914 /src/main/java/net/minecraft/server/EntityLeash.java | |
parent | a4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff) | |
download | craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip |
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityLeash.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityLeash.java | 137 |
1 files changed, 0 insertions, 137 deletions
diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java deleted file mode 100644 index 9b2ac823..00000000 --- a/src/main/java/net/minecraft/server/EntityLeash.java +++ /dev/null @@ -1,137 +0,0 @@ -package net.minecraft.server; - -import java.util.Iterator; -import java.util.List; - -import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit - -public class EntityLeash extends EntityHanging { - - public EntityLeash(World world) { - super(world); - } - - public EntityLeash(World world, int i, int j, int k) { - super(world, i, j, k, 0); - this.setPosition((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); - } - - protected void c() { - super.c(); - } - - public void setDirection(int i) {} - - public int f() { - return 9; - } - - public int i() { - return 9; - } - - public void b(Entity entity) {} - - public boolean d(NBTTagCompound nbttagcompound) { - return false; - } - - public void b(NBTTagCompound nbttagcompound) {} - - public void a(NBTTagCompound nbttagcompound) {} - - public boolean c(EntityHuman entityhuman) { - ItemStack itemstack = entityhuman.be(); - boolean flag = false; - double d0; - List list; - Iterator iterator; - EntityInsentient entityinsentient; - - if (itemstack != null && itemstack.getItem() == Items.LEASH && !this.world.isStatic) { - d0 = 7.0D; - list = this.world.a(EntityInsentient.class, AxisAlignedBB.a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0)); - if (list != null) { - iterator = list.iterator(); - - while (iterator.hasNext()) { - entityinsentient = (EntityInsentient) iterator.next(); - if (entityinsentient.bN() && entityinsentient.getLeashHolder() == entityhuman) { - // CraftBukkit start - if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, entityinsentient, entityinsentient.getLeashHolder())); - continue; - } - // CraftBukkit end - entityinsentient.setLeashHolder(this, true); - flag = true; - } - } - } - } - - if (!this.world.isStatic && !flag) { - // CraftBukkit start - Move below - // this.die(); - boolean die = true; - // CraftBukkit end - if (true || entityhuman.abilities.canInstantlyBuild) { // CraftBukkit - Process for non-creative as well - d0 = 7.0D; - list = this.world.a(EntityInsentient.class, AxisAlignedBB.a(this.locX - d0, this.locY - d0, this.locZ - d0, this.locX + d0, this.locY + d0, this.locZ + d0)); - if (list != null) { - iterator = list.iterator(); - - while (iterator.hasNext()) { - entityinsentient = (EntityInsentient) iterator.next(); - if (entityinsentient.bN() && entityinsentient.getLeashHolder() == this) { - // CraftBukkit start - if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) { - die = false; - continue; - } - entityinsentient.unleash(true, !entityhuman.abilities.canInstantlyBuild); // false -> survival mode boolean - // CraftBukkit end - } - } - } - } - // CraftBukkit start - if (die) { - this.die(); - } - // CraftBukkit end - } - - return true; - } - - public boolean survives() { - return this.world.getType(this.x, this.y, this.z).b() == 11; - } - - public static EntityLeash a(World world, int i, int j, int k) { - EntityLeash entityleash = new EntityLeash(world, i, j, k); - - entityleash.attachedToPlayer = true; - world.addEntity(entityleash); - return entityleash; - } - - public static EntityLeash b(World world, int i, int j, int k) { - List list = world.a(EntityLeash.class, AxisAlignedBB.a((double) i - 1.0D, (double) j - 1.0D, (double) k - 1.0D, (double) i + 1.0D, (double) j + 1.0D, (double) k + 1.0D)); - - if (list != null) { - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) { - EntityLeash entityleash = (EntityLeash) iterator.next(); - - if (entityleash.x == i && entityleash.y == j && entityleash.z == k) { - return entityleash; - } - } - } - - return null; - } -} |