예제 #1
0
 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;
   }
 }
예제 #2
0
  /**
   * 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;
    }
  }
예제 #3
0
  public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates) {
    IChunkProvider ichunkprovider = world.q();

    ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
    ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
    ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z + 3 >> 4);
    ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z + 3 >> 4);
    if (world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z)
        != Block.BED.id) {
      return null;
    } else {
      ChunkCoordinates chunkcoordinates1 =
          BlockBed.f(world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, 0);

      return chunkcoordinates1;
    }
  }
예제 #4
0
  public void populateChunk(
      IChunkProvider par1IChunkProvider, IChunkProvider par2IChunkProvider, int par3, int par4) {
    if (!this.isTerrainPopulated
        && par1IChunkProvider.chunkExists(par3 + 1, par4 + 1)
        && par1IChunkProvider.chunkExists(par3, par4 + 1)
        && par1IChunkProvider.chunkExists(par3 + 1, par4)) {
      par1IChunkProvider.populate(par2IChunkProvider, par3, par4);
    }

    if (par1IChunkProvider.chunkExists(par3 - 1, par4)
        && !par1IChunkProvider.provideChunk(par3 - 1, par4).isTerrainPopulated
        && par1IChunkProvider.chunkExists(par3 - 1, par4 + 1)
        && par1IChunkProvider.chunkExists(par3, par4 + 1)
        && par1IChunkProvider.chunkExists(par3 - 1, par4 + 1)) {
      par1IChunkProvider.populate(par2IChunkProvider, par3 - 1, par4);
    }

    if (par1IChunkProvider.chunkExists(par3, par4 - 1)
        && !par1IChunkProvider.provideChunk(par3, par4 - 1).isTerrainPopulated
        && par1IChunkProvider.chunkExists(par3 + 1, par4 - 1)
        && par1IChunkProvider.chunkExists(par3 + 1, par4 - 1)
        && par1IChunkProvider.chunkExists(par3 + 1, par4)) {
      par1IChunkProvider.populate(par2IChunkProvider, par3, par4 - 1);
    }

    if (par1IChunkProvider.chunkExists(par3 - 1, par4 - 1)
        && !par1IChunkProvider.provideChunk(par3 - 1, par4 - 1).isTerrainPopulated
        && par1IChunkProvider.chunkExists(par3, par4 - 1)
        && par1IChunkProvider.chunkExists(par3 - 1, par4)) {
      par1IChunkProvider.populate(par2IChunkProvider, par3 - 1, par4 - 1);
    }
  }
예제 #5
0
 public void func_35843_a(
     IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
   if (!field_1527_n
       && ichunkprovider.func_537_a(i + 1, j + 1)
       && ichunkprovider.func_537_a(i, j + 1)
       && ichunkprovider.func_537_a(i + 1, j)) {
     ichunkprovider.func_534_a(ichunkprovider1, i, j);
   }
   if (ichunkprovider.func_537_a(i - 1, j)
       && !ichunkprovider.func_533_b(i - 1, j).field_1527_n
       && ichunkprovider.func_537_a(i - 1, j + 1)
       && ichunkprovider.func_537_a(i, j + 1)
       && ichunkprovider.func_537_a(i - 1, j + 1)) {
     ichunkprovider.func_534_a(ichunkprovider1, i - 1, j);
   }
   if (ichunkprovider.func_537_a(i, j - 1)
       && !ichunkprovider.func_533_b(i, j - 1).field_1527_n
       && ichunkprovider.func_537_a(i + 1, j - 1)
       && ichunkprovider.func_537_a(i + 1, j - 1)
       && ichunkprovider.func_537_a(i + 1, j)) {
     ichunkprovider.func_534_a(ichunkprovider1, i, j - 1);
   }
   if (ichunkprovider.func_537_a(i - 1, j - 1)
       && !ichunkprovider.func_533_b(i - 1, j - 1).field_1527_n
       && ichunkprovider.func_537_a(i, j - 1)
       && ichunkprovider.func_537_a(i - 1, j)) {
     ichunkprovider.func_534_a(ichunkprovider1, i - 1, j - 1);
   }
 }