fixed support for multiworld beds

This commit is contained in:
Tahg 2011-06-09 09:44:25 -04:00
parent 4a0eb0a4a1
commit ca0711fdb3
2 changed files with 6 additions and 5 deletions

View File

@ -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;
}

View File

@ -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));