Package net.minecraft.world.chunk

Examples of net.minecraft.world.chunk.Chunk


  @Override
  @Declare
  public boolean setBlockAndMetadataWithUpdateWithoutValidate(int x, int y, int z, int id, int meta, boolean update) {
    if (x >= -30000000 && z >= -30000000 && x < 30000000 && z < 30000000 && y >= 0 && y < 256) {
      Chunk chunk = getChunkFromChunkCoords(x >> 4, z >> 4);
      if (!chunk.setBlockIDWithMetadataWithoutValidate(x & 15, y, z & 15, id, meta)) {
        return false;
      }
      theProfiler.startSection("checkLight");
      updateAllLightTypes(x, y, z);
      theProfiler.endSection();
View Full Code Here


      return entities;
    }

    for (int cX = var4; cX <= var5; ++cX) {
      for (int cZ = var6; cZ <= var7; ++cZ) {
        Chunk chunk = getChunkIfExists(cX, cZ);
        if (chunk != null) {
          chunk.getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, entities, par3IEntitySelector);
        }
      }
    }

    return entities;
View Full Code Here

      return entities;
    }

    for (int cX = var4; cX <= var5; ++cX) {
      for (int cZ = var6; cZ <= var7; ++cZ) {
        Chunk chunk = getChunkIfExists(cX, cZ);
        if (chunk != null) {
          chunk.getEntitiesOfTypeWithinAAAB(par1Class, par2AxisAlignedBB, entities, par3IEntitySelector);
        }
      }
    }

    return entities;
View Full Code Here

      return false;
    }
    if (e.isDead) {
      return true;
    }
    Chunk chunk = getChunkIfExists(((int) e.posX) >> 4, ((int) e.posZ) >> 4);
    if (chunk == null) {
      e.setDead();
      return true;
    }
    if (e instanceof EntityItem) {
View Full Code Here

      if (cX != x || cZ != z) {
        FMLLog.warning("Chunk file at " + x + ',' + z + " is in the wrong location; relocating. (Expected " + x + ", " + z + ", got " + cX + ", " + cZ + ')');
        levelTag.setInteger("xPos", x);
        levelTag.setInteger("zPos", z);
      }
      Chunk chunk = this.readChunkFromNBT(world, levelTag);

      try {
        MinecraftForge.EVENT_BUS.post(new ChunkDataEvent.Load(chunk, chunkTagCompound));
      } catch (Throwable t) {
        FMLLog.log(Level.SEVERE, t, "A mod failed to handle a ChunkDataEvent.Load event for " + x + ',' + z);
View Full Code Here

  @Override
  protected Chunk readChunkFromNBT(World world, NBTTagCompound nbtTagCompound) {
    int i = nbtTagCompound.getInteger("xPos");
    int j = nbtTagCompound.getInteger("zPos");
    Chunk chunk = new Chunk(world, i, j);
    chunk.heightMap = nbtTagCompound.getIntArray("HeightMap");
    chunk.isTerrainPopulated = nbtTagCompound.getBoolean("TerrainPopulated");
    NBTTagList nbttaglist = nbtTagCompound.getTagList("Sections");
    byte b0 = 16;
    ExtendedBlockStorage[] aextendedblockstorage = new ExtendedBlockStorage[b0];
    boolean flag = !world.provider.hasNoSky;

    for (int k = 0; k < nbttaglist.tagCount(); ++k) {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.tagAt(k);
      byte b1 = nbttagcompound1.getByte("Y");
      ExtendedBlockStorage extendedblockstorage = new ExtendedBlockStorage(b1 << 4, flag);
      extendedblockstorage.setBlockLSBArray(nbttagcompound1.getByteArray("Blocks"));

      if (nbttagcompound1.hasKey("Add")) {
        extendedblockstorage.setBlockMSBArray(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4));
      }

      extendedblockstorage.setBlockMetadataArray(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4));
      extendedblockstorage.setBlocklightArray(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4));

      if (flag) {
        extendedblockstorage.setSkylightArray(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4));
      }

      extendedblockstorage.removeInvalidBlocks();
      aextendedblockstorage[b1] = extendedblockstorage;
    }

    chunk.setStorageArrays(aextendedblockstorage);

    if (nbtTagCompound.hasKey("Biomes")) {
      chunk.setBiomeArray(nbtTagCompound.getByteArray("Biomes"));
    }

    NBTTagList nbttaglist1 = nbtTagCompound.getTagList("Entities");

    if (nbttaglist1 != null) {
      for (int l = 0; l < nbttaglist1.tagCount(); ++l) {
        NBTTagCompound nbttagcompound2 = (NBTTagCompound) nbttaglist1.tagAt(l);
        Entity entity = EntityList.createEntityFromNBT(nbttagcompound2, world);
        chunk.hasEntities = true;

        if (entity != null) {
          chunk.addEntity(entity);

          for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKey("Riding"); nbttagcompound3 = nbttagcompound3.getCompoundTag("Riding")) {
            Entity entity2 = EntityList.createEntityFromNBT(nbttagcompound3.getCompoundTag("Riding"), world);

            if (entity2 != null) {
              chunk.addEntity(entity2);
              entity.mountEntity(entity2);
            }
          }
        }
      }
    }

    NBTTagList nbttaglist2 = nbtTagCompound.getTagList("TileEntities");

    if (nbttaglist2 != null) {
      for (int i1 = 0; i1 < nbttaglist2.tagCount(); ++i1) {
        NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist2.tagAt(i1);
        TileEntity tileentity = TileEntity.createAndLoadEntity(nbttagcompound4);

        if (tileentity != null) {
          chunk.addTileEntity(tileentity);
        }
      }
    }

    if (nbtTagCompound.hasKey("TileTicks")) {
View Full Code Here

   
    return false;
  }
 
  public static void onBlockBreak(final World world, final int x, final int y, final int z, final int id, final int data) {
    Chunk cnk = world.getChunkFromBlockCoords(x, z);
    if (!cnk.isTerrainPopulated || !cnk.isChunkLoaded) {
      return;
    }
    try {
      throw new RuntimeException("nobody saw this");
View Full Code Here

        }
       
        @SubscribeEvent
        public void onChunkWatch(Watch event)
        {           
            Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos);
            for(WorldExtension extension : worldMap.get(event.player.worldObj))
                extension.watchChunk(chunk, event.player);
        }
View Full Code Here

        @SubscribeEvent
        @SideOnly(Side.CLIENT)
        public void onChunkUnWatch(UnWatch event)
        {
            Chunk chunk = event.player.worldObj.getChunkFromChunkCoords(event.chunk.chunkXPos, event.chunk.chunkZPos);
            for(WorldExtension extension : worldMap.get(event.player.worldObj))
                extension.unwatchChunk(chunk, event.player);
        }
View Full Code Here

    int chunkArrayX = (this.mw.playerXInt >> 4) - 1;
    int chunkArrayZ = (this.mw.playerZInt >> 4) - 1;
    MwChunk[] chunkArray = new MwChunk[9];
    for (int z = 0; z < 3; z++) {
      for (int x = 0; x < 3; x++) {
        Chunk chunk = this.mw.mc.theWorld.getChunkFromChunkCoords(
          chunkArrayX + x,
          chunkArrayZ + z
        );
        if (!chunk.isEmpty()) {
          chunkArray[(z * 3) + x] = copyToMwChunk(chunk);
        }
      }
    }
  }
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.