code: @SubscribeEvent
  	public void onDataSave(ChunkDataEvent.Save event)
  	{
  		NBTTagCompound nbt = event.getData();
  
  		for (HandlerInfo<?> handlerInfo : handlerInfos.values())
  		{
  			ChunkData<?> chunkData = chunkData(handlerInfo.identifier, event.getWorld(), event.getChunk());
  			if (chunkData != null && chunkData.hasData())
  			{
  				//				MalisisCore.message("onDataSave (" + event.getChunk().xPosition + "/" + event.getChunk().zPosition + ") for "
  				//						+ handlerInfo.identifier);
  				ByteBuf buf = Unpooled.buffer();
  				chunkData.toBytes(buf);
  				nbt.setByteArray(handlerInfo.identifier, buf.capacity(buf.writerIndex()).array());
  			}
  
  			//unload data on save because saving is called after unload
  			if (event.getChunk().unloadQueued)
  				datas.get().remove(handlerInfo.identifier, event.getChunk());
  
  		}
  	}
docs: On data save.
  
  @param event the event