@SubscribeEvent(priority = EventPriority.LOWEST)
 public void onChunkLoad(ChunkEvent.Load event) {
   Chunk chunk = event.getChunk();
   if (chunk != null) {
     List[] entityLists = chunk.entityLists;
     // sendChatMessage("chunk not null");
     for (List entityList : entityLists) {
       for (Object thing : entityList) {
         MobPicker.addMobInstance((Entity) thing);
       }
     }
   }
 }
示例#2
0
  @SubscribeEvent
  public void onChunk(ChunkEvent.Load event) {
    if (event.world.provider.dimensionId == -1 || event.world.provider.dimensionId == 1) {
      return;
    }

    if (!event.world.isRemote) {
      Chunk chunk = event.getChunk();
      // Load the Retro Data, if it's null OR the stored key does not match the configs key, load in
      // a new data set
      RetroData data =
          (RetroData) event.world.mapStorage.loadData(RetroData.class, "retrogen-mariculture");
      if (data == null || (data != null && data.getLastKey() != RetroGeneration.KEY)) {
        data = new RetroData();
        event.world.setItemData("retrogen-mariculture", data);
      }

      if (retro == null) {
        retro = new ArrayList<String>();
      }

      if (chunk.isChunkLoaded) {
        try {
          int x = chunk.xPosition * 16;
          int z = chunk.zPosition * 16;
          if (OreGeneration.NATURAL_GAS_ON && doGen(data, "gas", chunk))
            WorldGenHandler.generateGas(chunk.worldObj, Rand.rand, x, z);
          if (OreGeneration.BAUXITE_ON && doGen(data, "bauxite", chunk))
            WorldGenHandler.generateBauxite(chunk.worldObj, Rand.rand, x, z);
          if (OreGeneration.COPPER_ON && doGen(data, "copper", chunk))
            WorldGenHandler.generateCopper(chunk.worldObj, Rand.rand, x, z);
          if (WorldGeneration.OYSTER_ENABLED && doGen(data, "oyster", chunk))
            WorldGenHandler.generateOyster(chunk.worldObj, Rand.rand, x, z);
          if (Modules.world.isActive()
              && MaricultureHandlers.biomeType.getBiomeType(
                      chunk.worldObj.getBiomeGenForCoords(x, z))
                  == EnumBiomeType.OCEAN) {
            if (WorldGeneration.KELP_FOREST_ENABLED && doGen(data, "kelp", chunk))
              BiomeGenSandyOcean.kelpGenerator.generate(chunk.worldObj, Rand.rand, x, 0, z);
            if (WorldGeneration.CORAL_REEF_ENABLED && doGen(data, "coralreef", chunk))
              BiomeGenSandyOcean.generateCoral(
                  chunk.worldObj, Rand.rand, chunk.xPosition, chunk.zPosition);
            if (WorldGeneration.ANCIENT_SAND_ENABLED && doGen(data, "ancient", chunk))
              BiomeGenSandyOcean.generateSand(
                  chunk.worldObj, Rand.rand, chunk.xPosition, chunk.zPosition);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
  }