@SubscribeEvent
 public void onChunkUnload(ChunkEvent.Unload event) {
   List[] entityLists = event.getChunk().entityLists;
   for (List entityList : entityLists) {
     for (Object thing : entityList) {
       MobPicker.removeMobInstance((Entity) thing);
     }
   }
 }
Example #2
0
  @SubscribeEvent
  public void onChunkUnload(ChunkEvent.Unload event) {
    if (event.world.isRemote) {
      @SuppressWarnings("unchecked")
      Map<ChunkPosition, TileEntity> tiles = event.getChunk().chunkTileEntityMap;

      for (TileEntity light : tiles.values()) {
        if (light instanceof TileEntityLight) {
          ClientProxy.lights.remove(light);
        }
      }
    }
  }