Package net.minecraft.world.chunk

Examples of net.minecraft.world.chunk.Chunk


      String blockRaw = args[i];
      if (blockRaw.charAt(0) == '*') {
        if (blockRaw.equals("*fluid")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                if (block.getMaterial().isLiquid()) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*tree")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                if (block.isWood(world, x, y, z) || block.isLeaves(world, x, y, z)) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.startsWith("*repl")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                if (block.isReplaceable(world, x, y, z)) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*stone")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                if (block.getMaterial() == Material.rock) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*sand")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                if (block.getMaterial() == Material.sand) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*dirt")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                Material m = block.getMaterial();
                if (m == Material.grass || m == Material.ground || m == Material.clay || m == Material.snow
                    || m == Material.craftedSnow || m == Material.ice || m == Material.packedIce) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*plants")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                Material m = block.getMaterial();
                if (m == Material.plants || m == Material.vine || m == Material.cactus || m == Material.leaves) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        } else if (blockRaw.equals("*fire")) {
          for (int x = xS; x <= xL; ++x) {
            for (int z = zS; z <= zL; ++z) {
              Chunk chunk = world.getChunkFromBlockCoords(x, z);
              int cX = x & 15, cZ = z & 15;
              for (int y = yS; y <= yL; ++y) {
                Block block = chunk.getBlock(cX, y, cZ);
                Material m = block.getMaterial();
                if (m == Material.fire || m == Material.lava || block.isBurning(world, x, y, z)) {
                  if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                    set.add(chunk);
                  }
                }
              }
            }
          }
        }
        continue;
      }
      int meta = -1;
      t = blockRaw.indexOf('#');
      if (t > 0) {
        meta = CommandBase.parseInt(sender, blockRaw.substring(t + 1));
        blockRaw = blockRaw.substring(0, t);
      }
      Block block = Block.getBlockFromName(blockRaw);
      if (block == Blocks.air) {
        continue;
      }

      for (int x = xS; x <= xL; ++x) {
        for (int z = zS; z <= zL; ++z) {
          Chunk chunk = world.getChunkFromBlockCoords(x, z);
          int cX = x & 15, cZ = z & 15;
          for (int y = yS; y <= yL; ++y) {
            boolean v = meta == -1 || chunk.getBlockMetadata(cX, y, cZ) == meta;
            if (v && chunk.getBlock(cX, y, cZ) == block) {
              if (chunk.func_150807_a(cX, y, cZ, Blocks.air, 0)) {
                set.add(chunk);
              }
            }
          }
        }
      }
    }

    if (world instanceof WorldServer) {
      TObjectHashIterator<Chunk> c = set.iterator();
      for (int k = 0, e = set.size(); k < e; ++k) {
        Chunk chunk = c.next();
        PlayerManager manager = ((WorldServer) world).getPlayerManager();
        if (manager == null) {
          return;
        }
        PlayerInstance watcher = manager.getOrCreateChunkWatcher(chunk.xPosition, chunk.zPosition, false);
View Full Code Here


    private static final String DENSEORES = "DenseOres";

    // generates blocks in the world
    @Override
    public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
        Chunk chunk = world.getChunkFromChunkCoords(chunkX, chunkZ);
        for (BlockDenseOre dense_ore_blocks : DenseOresRegistry.blocks.values()) {
            for (int id = 0; id < 16; id++) {
                if (dense_ore_blocks.isValid(id)) {
                    genChunk(chunk, random, dense_ore_blocks, id);
                }
View Full Code Here

        for (int i = 0; i < speed; i++)
        {
            try
            {
                Chunk chunk = world.theChunkProviderServer.loadChunk(X, Z);
                chunk.setChunkModified();
                world.theChunkProviderServer.safeSaveChunk(chunk);
                world.theChunkProviderServer.unloadQueuedChunks();
                world.theChunkProviderServer.unloadChunksIfNotNearSpawn(X, Z);

                todo--;
View Full Code Here

            left.add(String.format("z: %.5f (%d) // c: %d (%d)", mc.thePlayer.posZ, z, z >> 4, z & 15));
            left.add(String.format("f: %d (%s) / %f", heading, Direction.directions[heading], MathHelper.wrapAngleTo180_float(yaw)));

            if (mc.theWorld != null && mc.theWorld.blockExists(x, y, z))
            {
                Chunk chunk = this.mc.theWorld.getChunkFromBlockCoords(x, z);
                left.add(String.format("lc: %d b: %s bl: %d sl: %d rl: %d",
                  chunk.getTopFilledSegment() + 15,
                  chunk.getBiomeGenForWorldCoords(x & 15, z & 15, mc.theWorld.getWorldChunkManager()).biomeName,
                  chunk.getSavedLightValue(EnumSkyBlock.Block, x & 15, y, z & 15),
                  chunk.getSavedLightValue(EnumSkyBlock.Sky, x & 15, y, z & 15),
                  chunk.getBlockLightValue(x & 15, y, z & 15, 0)));
            }
            else
            {
                left.add(null);
            }
View Full Code Here

        Cache<Long, Chunk> cache = dormantChunkCache.get(world);
        if (cache == null)
        {
            return null;
        }
        Chunk chunk = cache.getIfPresent(coords);
        if (chunk != null)
        {
            for (List<Entity> eList : (List<Entity>[])chunk.entityLists)
            {
                for (Entity e: eList)
View Full Code Here

        }
        return rand.nextDouble() <= 0.3 && isWaterDeep(world, x, z, MIN_DEPTH);
    }

    private boolean isWaterDeep(World world, int x, int z, int minDepth) {
        Chunk chunk = world.getChunkFromBlockCoords(x, z);
        int y = chunk.getTopFilledSegment() + 15;

        int trimmedX = x & 15;
        int trimmedZ = z & 15;

        int depth = 0;
        for (; y > 0; --y) {
            Block block = chunk.getBlock(trimmedX, y, trimmedZ);
            if (block == null || block == Blocks.air) {
                continue;
            }
            if (block.getMaterial() == Material.water) {
                depth++;
View Full Code Here

    te.setWorldObj( w );
    te.xCoord = x;
    te.yCoord = y;
    te.zCoord = z;

    Chunk c = w.getChunkFromBlockCoords( x, z );
    c.func_150812_a( x & 0xF, y, z & 0xF, te );
    // c.setChunkBlockTileEntity( x & 0xF, y, z & 0xF, te );

    if ( c.isChunkLoaded )
    {
      w.addTileEntity( te );
View Full Code Here

      for (int cz = 0; cz < cz_size; cz++)
      {
        LinkedList<Entry<ChunkPosition, TileEntity>> rwarTiles = new LinkedList<Entry<ChunkPosition, TileEntity>>();
        LinkedList<ChunkPosition> deadTiles = new LinkedList<ChunkPosition>();

        Chunk c = w.getChunkFromChunkCoords( minCX + cx, minCZ + cz );
        myChunks[cx][cz] = c;

        rwarTiles.addAll( ((HashMap<ChunkPosition, TileEntity>) c.chunkTileEntityMap).entrySet() );
        for (Entry<ChunkPosition, TileEntity> tx : rwarTiles)
        {
View Full Code Here

    // update shit..
    for (int x = 0; x < cx_size; x++)
      for (int z = 0; z < cz_size; z++)
      {
        Chunk c = myChunks[x][z];
        c.resetRelightChecks();
        c.generateSkylightMap();
        c.isModified = true;
      }

    // send shit...
    for (int x = 0; x < cx_size; x++)
      for (int z = 0; z < cz_size; z++)
      {

        Chunk c = myChunks[x][z];

        for (int y = 1; y < 255; y += 32)
          WorldSettings.getInstance().getCompass().updateArea( world, c.xPosition << 4, y, c.zPosition << 4 );

        Platform.sendChunk( c, verticalBits );
View Full Code Here

    if ( qc != null )
    {
      World theWorld = qc.getCenter().getWorldObj();
      if ( !qc.isDestroyed )
      {
        Chunk c = theWorld.getChunkFromBlockCoords( qc.center.xCoord, qc.center.zCoord );
        if ( c.isChunkLoaded )
        {
          int id = theWorld.provider.dimensionId;
          World cur = DimensionManager.getWorld( id );
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.