Package net.minecraft.world.chunk

Examples of net.minecraft.world.chunk.Chunk


  /**
   * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
   * specified chunk from the map seed and chunk seed
   */
  public Chunk provideChunk(int par1, int par2) {
    Chunk chunk = new Chunk(this.worldObj, par1, par2);

    for (int k = 0; k < this.cachedBlockIDs.length; ++k) {
      int l = k >> 4;
      ExtendedBlockStorage extendedblockstorage = chunk.getBlockStorageArray()[l];

      if (extendedblockstorage == null) {
        extendedblockstorage = new ExtendedBlockStorage(k, !this.worldObj.provider.hasNoSky);
        chunk.getBlockStorageArray()[l] = extendedblockstorage;
      }

      for (int i1 = 0; i1 < 16; ++i1) {
        for (int j1 = 0; j1 < 16; ++j1) {
          extendedblockstorage.func_150818_a(i1, k & 15, j1, Block.getBlockById(this.cachedBlockIDs[k] & 255));
          extendedblockstorage.setExtBlockMetadata(i1, k & 15, j1, this.cachedBlockMetadata[k]);
        }
      }
    }

    chunk.generateSkylightMap();
    BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(null, par1 * 16, par2 * 16, 16, 16);
    byte[] abyte = chunk.getBiomeArray();

    for (int k1 = 0; k1 < abyte.length; ++k1) {
      abyte[k1] = (byte) abiomegenbase[k1].biomeID;
    }
    chunk.generateSkylightMap();
    return chunk;
  }
View Full Code Here


              worldObj.setBlock(targetX, yCoord + 1, targetZ, worldObj.getBlock(xCoord, yCoord + 1, zCoord), worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord), 3);
              passenger.invalidate();
              worldObj.setBlockToAir(xCoord, yCoord + 1, zCoord);

              //IMovableHandler default code
              Chunk c = worldObj.getChunkFromBlockCoords(targetX, targetZ);

              c.func_150812_a(targetX & 0xF, yCoord + 1, targetZ & 0xF, passenger);

              if (c.isChunkLoaded) {
                worldObj.addTileEntity(passenger);
                worldObj.markBlockForUpdate(targetX, yCoord + 1, targetZ);
              }
View Full Code Here

        int x = position.getBlockX();
        int y = position.getBlockY();
        int z = position.getBlockZ();

        // First set the block
        Chunk chunk = world.getChunkFromChunkCoords(x >> 4, z >> 4);
        int previousId = 0;

        if (notifyAndLight) {
            previousId = Block.getIdFromBlock(chunk.getBlock(x & 15, y, z & 15));
        }

        boolean successful = chunk.func_150807_a(x & 15, y, z & 15, Block.getBlockById(block.getId()), block.getData());

        // Create the TileEntity
        if (successful) {
            CompoundTag tag = block.getNbtData();
            if (tag != null) {
View Full Code Here

    @Override
    public boolean setBiome(Vector2D position, BaseBiome biome) {
        checkNotNull(position);
        checkNotNull(biome);

        Chunk chunk = getWorld().getChunkFromBlockCoords(position.getBlockX(), position.getBlockZ());
        if ((chunk != null) && (chunk.isChunkLoaded)) {
            chunk.getBiomeArray()[((position.getBlockZ() & 0xF) << 4 | position.getBlockX() & 0xF)] = (byte) biome.getId();
            return true;
        }

        return false;
    }
View Full Code Here

                p.setAccessible(true);
                IChunkProvider chunkProvider = (IChunkProvider) p.get(chunkServer);

                for (Vector2D coord : chunks) {
                    long pos = ChunkCoordIntPair.chunkXZ2Int(coord.getBlockX(), coord.getBlockZ());
                    Chunk mcChunk;
                    if (chunkServer.chunkExists(coord.getBlockX(), coord.getBlockZ())) {
                        mcChunk = chunkServer.loadChunk(coord.getBlockX(), coord.getBlockZ());
                        mcChunk.onChunkUnload();
                    }
                    unloadQueue.remove(pos);
                    loadedMap.remove(pos);
                    mcChunk = chunkProvider.provideChunk(coord.getBlockX(), coord.getBlockZ());
                    loadedMap.add(pos, mcChunk);
                    loaded.add(mcChunk);
                    if (mcChunk != null) {
                        mcChunk.onChunkLoad();
                        mcChunk.populateChunk(chunkProvider, chunkProvider, coord.getBlockX(), coord.getBlockZ());
                    }
                }
            } catch (Throwable t) {
                logger.log(Level.WARNING, "Failed to generate chunk", t);
                return false;
View Full Code Here

        for (Vector2D pt : region.getChunks()) {
            if (!world.getChunkProvider().chunkExists(pt.getBlockX(), pt.getBlockZ())) {
                continue;
            }

            Chunk chunk = world.getChunkProvider().provideChunk(pt.getBlockX(), pt.getBlockZ());
            for (List<net.minecraft.entity.Entity> entitySubList : chunk.entityLists) {
                for (net.minecraft.entity.Entity entity : entitySubList) {
                    if (region.contains(new Vector(entity.posX, entity.posY, entity.posZ))) {
                        entities.add(new ForgeEntity(entity));
                    }
View Full Code Here

    origin.set(ioX + 0.5, ioY + 0.5, ioZ + 0.5);
    pitchRot.setIdentity();
    yawRot.setIdentity();

    Chunk c = world.getChunkFromBlockCoords(ioX, ioZ);
    chunkLoaded = c != null && c.isChunkLoaded;
    RB.blockAccess = world;

    blocks.add(new ViewableBlocks(ioX, ioY, ioZ, EnderIO.blockEnderIo));
View Full Code Here

      {
        int blockId = position.getBlockID(world);

        if (Block.blocksList[blockId] != null)
        {
          Chunk chunk = world.getChunkFromBlockCoords(position.intX(), position.intZ());

          if (chunk != null && chunk.isChunkLoaded && (MFFSHelper.hasPermission(world, position, Action.RIGHT_CLICK_BLOCK, entityPlayer) || MFFSHelper.hasPermission(world, position, Permission.REMOTE_CONTROL, entityPlayer)))
          {
            float requiredEnergy = (float) Vector3.distance(new Vector3(entityPlayer), position) * (FluidContainerRegistry.BUCKET_VOLUME / 100);
            int receivedEnergy = 0;
View Full Code Here

        //byte[] upperArray = new byte[32768];
        this.generateNetherTerrain(chunkX, chunkZ, lowerArray);
        this.replaceBlocksForBiome(chunkX, chunkZ, aBlock, lowerArray);
        this.netherCaveGenerator.func_151539_a(this, this.worldObj, chunkX, chunkZ, aBlock);
        this.genNetherBridge.func_151539_a(this, this.worldObj, chunkX, chunkZ, aBlock);
        Chunk chunk = new NetheriteChunk(this.worldObj, lowerArray, chunkX, chunkZ);
        BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[]) null, chunkX * 16, chunkZ * 16, 16, 16);
        byte[] abyte1 = chunk.getBiomeArray();

        for (int k = 0; k < abyte1.length; ++k)
        {
            abyte1[k] = (byte) abiomegenbase[k].biomeID;
        }

        chunk.resetRelightChecks();
        return chunk;
    }
View Full Code Here

    }
   
    public static TileEntity getTileEntityUnsafe(World world, int x, int y, int z) {
      TileEntity te = null;
     
      Chunk chunk = world.getChunkFromBlockCoords(x, z);
      if(chunk != null) {
        te = chunk.getTileEntityUnsafe(x & 0x0F, y, z & 0x0F);
      }
     
      return te;
    }
View Full Code Here

TOP

Related Classes of net.minecraft.world.chunk.Chunk

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.