Package org.bukkit

Examples of org.bukkit.Chunk


      for (int y = coords[1]; y <= coords[4]; y++)
        for (int z = coords[2]; z <= coords[5]; z++) {
          Block block = world.getBlockAt(x, y, z);

          // load chunk if needed
          Chunk here = block.getChunk();
          if (!here.isLoaded()) here.load();

          // set type
          block.setTypeId(blockType.getId(), false);

          // add to list of changed chunks
View Full Code Here


      for (int y = 0; y < blockData[0].length; y++)
        for (int z = 0; z < blockData[0][0].length; z++) {
          Block block = this.world.getBlockAt(this.coords[0] + x, this.coords[1] + y, this.coords[2] + z);

          // load chunk if needed
          Chunk here = block.getChunk();
          if (!here.isLoaded()) here.load();

          //if (blockData[x][y][z].getTypeId() != block.getTypeId() || blockData[x][y][z].getData() != block.getData()) {
          //  System.out.println(block);
            block.setTypeIdAndData(blockData[x][y][z].getTypeId(), blockData[x][y][z].getData(), false);
          //}
View Full Code Here

        for (int z = 0; z < blockData[0][0].length; z++) {
          if (this.region.contains(coords[0] + x, coords[1] + y, coords[2] + z)) { // only restore, if within the region
            Block block = this.world.getBlockAt(coords[0] + x, coords[1] + y, coords[2] + z);

            // load chunk if needed
            Chunk here = block.getChunk();
            if (!here.isLoaded()) here.load();
           
            //if (blockData[x][y][z].getTypeId() != block.getTypeId() || blockData[x][y][z].getData() != block.getData()) {
            //  System.out.println(block);
              block.setTypeIdAndData(blockData[x][y][z].getTypeId(), blockData[x][y][z].getData(), false);
            //}
View Full Code Here

  }

  @Override
  public void spawn(Location inLocation, boolean inForce)
  {
    Chunk c = inLocation.getChunk();
    if(c == null)
      return;

    if(!c.isLoaded() && inForce)
    {
      if(!c.load())
        return;
    }

    this.spawn(inLocation);
  }
View Full Code Here

        double   kx = k.getX();
        double   kz = k.getZ();
        World   kw = k.getWorld();

        Chunk   ck = p.getLocation().getChunk();
        double   px = ck.getX();
        double   pz = ck.getZ();
        World   pw = ck.getWorld();

        if (kx == px && kz == pz && kw.getName().equals(pw.getName())) {
          if (Properties.chunkDebug)
            ShowCaseStandalone.dlog("Found scs to load: " + p.getUUID());
View Full Code Here

        double  kx = k.getX();
        double   kz = k.getZ();
        World   kw = k.getWorld();

        Chunk   ck = p.getLocation().getChunk();
        double   px = ck.getX();
        double   pz = ck.getZ();
        World  pw = ck.getWorld();

        if (kx == px && kz == pz && kw.getName().equals(pw.getName())) {

          if (Properties.chunkDebug) {
            ShowCaseStandalone.dlog("Found scs to unload: " + p.getUUID());
View Full Code Here

            }
            /* If it did load, make cache of it */
            if(didload) {
                tileData = new DynIntHashMap();

                Chunk c = w.getChunkAt(chunk.x, chunk.z);   /* Get the chunk */
                /* Get inhabited ticks count */
                inhabited_ticks = helper.getInhabitedTicks(c);
                if(!vis) {
                    if(hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN)
                        ss = STONE;
                    else if(hidestyle == HiddenChunkStyle.FILL_OCEAN)
                        ss = OCEAN;
                    else
                        ss = EMPTY;
                }
                else {
                    if(blockdata || highesty) {
                        ss = c.getChunkSnapshot(highesty, biome, biomeraw);
                        /* Get tile entity data */
                        List<Object> vals = new ArrayList<Object>();
                        Map<?,?> tileents = helper.getTileEntitiesForChunk(c);
                        for(Object t : tileents.values()) {
                            int te_x = helper.getTileEntityX(t);
View Full Code Here

        ongeneratechunk = core.isTrigger("chunkgenerated");
        if(ongeneratechunk) {
            Listener chunkTrigger = new Listener() {
                @EventHandler(priority=EventPriority.MONITOR, ignoreCancelled=true)
                public void onChunkPopulate(ChunkPopulateEvent event) {
                    Chunk c = event.getChunk();
                    ChunkSnapshot cs = c.getChunkSnapshot();
                    int ymax = 0;
                    for(int i = 0; i < c.getWorld().getMaxHeight() / 16; i++) {
                        if(!cs.isSectionEmpty(i)) {
                            ymax = (i+1)*16;
                        }
                    }
                    /* Touch extreme corners */
                    int x = c.getX() << 4;
                    int z = c.getZ() << 4;
                    mapManager.touchVolume(getWorld(event.getWorld()).getName(), x, 0, z, x+15, ymax, z+16, "chunkpopulate");
                }
            };
            pm.registerEvents(chunkTrigger, this);
        }
View Full Code Here

 
  private final static boolean equals(final @Nullable Object o, final @Nullable Object d) {
    if (o instanceof Chunk) { // CraftChunk does neither override equals nor is it a "coordinate-specific singleton" like Block
      if (!(d instanceof Chunk))
        return false;
      final Chunk c1 = (Chunk) o, c2 = (Chunk) d;
      return c1.getWorld().equals(c2.getWorld()) && c1.getX() == c2.getX() && c1.getZ() == c2.getZ();
    }
    return o == null ? d == null : o.equals(d);
  }
View Full Code Here

       
        @Override
        public boolean hasNext() {
          Iterator<Block> current = this.current;
          while ((current == null || !current.hasNext()) && cs.hasNext()) {
            final Chunk c = cs.next().asBukkitChunk();
            if (c == null)
              continue;
            current = new AABB(c).iterator();
          }
          this.current = current;
View Full Code Here

TOP

Related Classes of org.bukkit.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.