Package net.minecraft.server

Examples of net.minecraft.server.Chunk


    // Only do this replacement logic for Entities that are already spawned
    if (this.isSpawned()) {
      // Now proceed to replace this NMS Entity in all places imaginable.
      // First load the chunk so we can at least work on something
      Chunk chunk = CommonNMS.getNative(getWorld().getChunkAt(getChunkX(), getChunkZ()));

      // *** Entities By ID Map ***
      final IntHashMap<Object> entitiesById = WorldServerRef.entitiesById.get(oldInstance.world);
      if (entitiesById.remove(oldInstance.getId()) == null) {
        CommonUtil.nextTick(new Runnable() {
View Full Code Here


    // Perform chunk load from file timings
    if (!CommonPlugin.TIMINGS.isActive()) {
      return super.loadChunk(x, z);
    } else {
      long time = System.nanoTime();
      Chunk nmsChunk = super.loadChunk(x, z);
      if (nmsChunk != null) {
        time = System.nanoTime() - time;
        CommonPlugin.TIMINGS.onChunkLoad(Conversion.toChunk.convert(nmsChunk), time);
      }
      return nmsChunk;
View Full Code Here

    if (!CommonPlugin.TIMINGS.isActive()) {
      super.getChunkAt(ichunkprovider, i, j);
      return;
    }

    Chunk chunk = this.getOrCreateChunk(i, j);

    if (!chunk.done) {
      chunk.done = true;
      this.chunkProvider.getChunkAt(ichunkprovider, i, j);

      // CraftBukkit start
      BlockSand.instaFall = true;
      final Random random = new Random();
      random.setSeed(world.getSeed());
      long xRand = random.nextLong() / 2L * 2L + 1L;
      long zRand = random.nextLong() / 2L * 2L + 1L;
      random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());

      // Call populators
      long time;
      org.bukkit.World bWorld = getWorld();
      org.bukkit.Chunk bChunk = CommonNMS.getChunk(chunk);
      for (BlockPopulator populator : bWorld.getPopulators()) {
        time = System.nanoTime();
        try {
          populator.populate(bWorld, random, bChunk);
        } finally {
          time = System.nanoTime() - time;
          CommonPlugin.TIMINGS.onChunkPopulate(bChunk, populator, time);
        }
      }

      // Done
      BlockSand.instaFall = false;
      super.world.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
      // CraftBukkit end

      chunk.e();
    }
  }
View Full Code Here

      return null;
    }

    // Initial registration of the chunk on the server
    WorldUtil.setChunk(getWorld(), x, z, chunk);
    Chunk chunkHandle = CommonNMS.getNative(chunk);
    ChunkRef.addEntities(chunkHandle);

    // CraftBukkit start
    Server server = WorldUtil.getServer(getWorld());
    if (server != null) {
View Full Code Here

   */
  @Override
  @Deprecated
  public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
    checkGenerator();
    Chunk chunk = this.getOrCreateChunk(i, j);

    if (!chunk.done) {
      chunk.done = true;
      this.chunkProvider.getChunkAt(ichunkprovider, i, j);

      // CraftBukkit start
      BlockSand.instaFall = true;
      final Random random = new Random();
      random.setSeed(world.getSeed());
      long xRand = random.nextLong() / 2L * 2L + 1L;
      long zRand = random.nextLong() / 2L * 2L + 1L;
      random.setSeed((long) i * xRand + (long) j * zRand ^ world.getSeed());

      if (world != null) {
        for (BlockPopulator populator : world.getPopulators()) {
          onPopulate(chunk.bukkitChunk, populator, random);
        }
      }
      BlockSand.instaFall = false;
      super.world.getServer().getPluginManager().callEvent(new ChunkPopulateEvent(chunk.bukkitChunk));
      // CraftBukkit end

      chunk.e();
    }
  }
View Full Code Here

   * @param z - coordinate of the chunk
   * @param chunk to set to (use null to remove)
   */
  @SuppressWarnings({ "rawtypes", "unchecked" })
  public static void setChunk(World world, final int x, final int z, final org.bukkit.Chunk chunk) {
    final Chunk handle = CommonNMS.getNative(chunk);
    if (handle != null && handle.bukkitChunk == null) {
      throw new RuntimeException("Can not put a chunk that has no BukkitChunk");
    }
    if (canUseLongObjectHashMap) {
      Object cps = CommonNMS.getNative(world).chunkProviderServer;
View Full Code Here

TOP

Related Classes of net.minecraft.server.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.