diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-05-31 15:55:45 +0200 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-05-31 15:56:05 +0200 |
commit | 62b5da4e3a6c9f930e08da292e603aa8b8df436e (patch) | |
tree | 981af01e9600593f9a1b5775bbbf3ebd472a0f36 /src/main/java/net/minecraft/server/EntityHuman.java | |
parent | 6dbd710bbf37728eb760cacb019d1e384a7e1311 (diff) | |
download | craftbukkit-62b5da4e3a6c9f930e08da292e603aa8b8df436e.tar craftbukkit-62b5da4e3a6c9f930e08da292e603aa8b8df436e.tar.gz craftbukkit-62b5da4e3a6c9f930e08da292e603aa8b8df436e.tar.lz craftbukkit-62b5da4e3a6c9f930e08da292e603aa8b8df436e.tar.xz craftbukkit-62b5da4e3a6c9f930e08da292e603aa8b8df436e.zip |
Update for 1.6.6
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityHuman.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityHuman.java | 130 |
1 files changed, 69 insertions, 61 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 171a0d1a..57727cab 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -78,10 +78,12 @@ public abstract class EntityHuman extends EntityLiving { this.sleepTicks = 100; } - if (!this.o()) { - this.a(true, true, false); - } else if (!this.world.isStatic && this.world.d()) { - this.a(false, true, true); + if (!this.world.isStatic) { + if (!this.o()) { + this.a(true, true, false); + } else if (this.world.d()) { + this.a(false, true, true); + } } } else if (this.sleepTicks > 0) { ++this.sleepTicks; @@ -375,7 +377,7 @@ public abstract class EntityHuman extends EntityLiving { if (this.health <= 0) { return false; } else { - if (this.isSleeping()) { + if (this.isSleeping() && !this.world.isStatic) { this.a(true, true, false); } @@ -568,72 +570,78 @@ public abstract class EntityHuman extends EntityLiving { } public EnumBedError a(int i, int j, int k) { - if (!this.isSleeping() && this.S()) { + if (!this.world.isStatic) { + if (this.isSleeping() || !this.S()) { + return EnumBedError.OTHER_PROBLEM; + } + if (this.world.worldProvider.c) { return EnumBedError.NOT_POSSIBLE_HERE; - } else if (this.world.d()) { + } + + if (this.world.d()) { return EnumBedError.NOT_POSSIBLE_NOW; - } else if (Math.abs(this.locX - (double) i) <= 3.0D && Math.abs(this.locY - (double) j) <= 2.0D && Math.abs(this.locZ - (double) k) <= 3.0D) { - // CraftBukkit start - if (this.getBukkitEntity() instanceof Player) { - Player player = (Player) this.getBukkitEntity(); - CraftServer server = ((WorldServer) world).getServer(); - org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k); - PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed); - server.getPluginManager().callEvent(event); + } - if (event.isCancelled()) { - return EnumBedError.OTHER_PROBLEM; - } - } - // CraftBukkit end - - this.b(0.2F, 0.2F); - this.height = 0.2F; - if (this.world.isLoaded(i, j, k)) { - int l = this.world.getData(i, j, k); - int i1 = BlockBed.c(l); - float f = 0.5F; - float f1 = 0.5F; - - switch (i1) { - case 0: - f1 = 0.9F; - break; - - case 1: - f = 0.1F; - break; - - case 2: - f1 = 0.1F; - break; - - case 3: - f = 0.9F; - } + if (Math.abs(this.locX - (double) i) > 3.0D || Math.abs(this.locY - (double) j) > 2.0D || Math.abs(this.locZ - (double) k) > 3.0D) { + return EnumBedError.TOO_FAR_AWAY; + } + } - this.e(i1); - this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1)); - } else { - this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F)); - } + // CraftBukkit start + if (this.getBukkitEntity() instanceof Player) { + Player player = (Player) this.getBukkitEntity(); + CraftServer server = ((WorldServer) world).getServer(); + org.bukkit.block.Block bed = ((WorldServer) world).getWorld().getBlockAt(i, j, k); + PlayerBedEnterEvent event = new PlayerBedEnterEvent(player, bed); + server.getPluginManager().callEvent(event); - this.sleeping = true; - this.sleepTicks = 0; - this.A = new ChunkCoordinates(i, j, k); - this.motX = this.motZ = this.motY = 0.0D; - if (!this.world.isStatic) { - this.world.everyoneSleeping(); - } + if (event.isCancelled()) { + return EnumBedError.OTHER_PROBLEM; + } + } + // CraftBukkit end - return EnumBedError.OK; - } else { - return EnumBedError.TOO_FAR_AWAY; + this.b(0.2F, 0.2F); + this.height = 0.2F; + if (this.world.isLoaded(i, j, k)) { + int l = this.world.getData(i, j, k); + int i1 = BlockBed.c(l); + float f = 0.5F; + float f1 = 0.5F; + + switch (i1) { + case 0: + f1 = 0.9F; + break; + + case 1: + f = 0.1F; + break; + + case 2: + f1 = 0.1F; + break; + + case 3: + f = 0.9F; } + + this.e(i1); + this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1)); } else { - return EnumBedError.OTHER_PROBLEM; + this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F)); } + + this.sleeping = true; + this.sleepTicks = 0; + this.A = new ChunkCoordinates(i, j, k); + this.motX = this.motZ = this.motY = 0.0D; + if (!this.world.isStatic) { + this.world.everyoneSleeping(); + } + + return EnumBedError.OK; } private void e(int i) { |