diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index eef5347f48..2c68c7c4b5 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -38,7 +38,7 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit start public boolean sleeping; public boolean fauxSleeping; - public String spawnWorld; + public String spawnWorld = ""; // CraftBukkit end public ChunkCoordinates A; public int sleepTicks; // CraftBukkit - private -> public @@ -760,6 +760,7 @@ public abstract class EntityHuman extends EntityLiving { public void a(ChunkCoordinates chunkcoordinates) { if (chunkcoordinates != null) { this.b = new ChunkCoordinates(chunkcoordinates); + this.spawnWorld = world.worldData.name; } else { this.b = null; } diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index 425736f644..316e7be75a 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -216,7 +216,7 @@ public class ServerConfigurationManager { if(cw != null && chunkcoordinates != null) { ChunkCoordinates chunkcoordinates1 = EntityHuman.getBed(cw.getHandle(), chunkcoordinates); if (chunkcoordinates1 != null) { - location = new Location(cw, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z); + location = new Location(cw, chunkcoordinates1.x + 0.5, chunkcoordinates1.y + 0.1, chunkcoordinates1.z + 0.5); } else { entityplayer.netServerHandler.sendPacket(new Packet70Bed(0)); } @@ -239,10 +239,10 @@ public class ServerConfigurationManager { WorldServer worldserver = ((CraftWorld)location.getWorld()).getHandle(); worldserver.chunkProviderServer.getChunkAt((int) entityplayer.locX >> 4, (int) entityplayer.locZ >> 4); - while (worldserver.getEntities(entityplayer, entityplayer.boundingBox).size() != 0) { - entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ); + while (worldserver.getTypeId(location.getBlockX(), location.getBlockY(), location.getBlockZ()) != 0 || + worldserver.getTypeId(location.getBlockX(), location.getBlockY() + 1, location.getBlockZ()) != 0) { + location.setY(location.getY() + 1); } - byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); entityplayer.netServerHandler.sendPacket(new Packet9Respawn((byte) (actualDimension >= 0 ? -1 : 0))); entityplayer.netServerHandler.sendPacket(new Packet9Respawn(actualDimension));