public static ChunkCoordinates verifyRespawnCoordinates( World world, ChunkCoordinates chunkcoordinates) { IChunkProvider ichunkprovider = world.getIChunkProvider(); ichunkprovider.loadChunk(chunkcoordinates.posX - 3 >> 4, chunkcoordinates.posZ - 3 >> 4); ichunkprovider.loadChunk(chunkcoordinates.posX + 3 >> 4, chunkcoordinates.posZ - 3 >> 4); ichunkprovider.loadChunk(chunkcoordinates.posX - 3 >> 4, chunkcoordinates.posZ + 3 >> 4); ichunkprovider.loadChunk(chunkcoordinates.posX + 3 >> 4, chunkcoordinates.posZ + 3 >> 4); if (world.getBlockId(chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ) != Block.bed.blockID) { return null; } else { ChunkCoordinates chunkcoordinates1 = BlockBed.getNearestEmptyChunkCoordinates( world, chunkcoordinates.posX, chunkcoordinates.posY, chunkcoordinates.posZ, 0); return chunkcoordinates1; } }
/** * Ensure that a block enabling respawning exists at the specified coordinates and find an empty * space nearby to spawn. */ public static ChunkCoordinates verifyRespawnCoordinates( World par0World, ChunkCoordinates par1ChunkCoordinates) { IChunkProvider var2 = par0World.getChunkProvider(); var2.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ - 3 >> 4); var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ - 3 >> 4); var2.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); ChunkCoordinates c = par1ChunkCoordinates; Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)]; if (block == null || !block.isBed(par0World, c.posX, c.posY, c.posZ, null)) { return null; } else { ChunkCoordinates var3 = block.getBedSpawnPosition(par0World, c.posX, c.posY, c.posZ, null); return var3; } }