Search in sources :

Example 1 with NetworkData

use of sonar.flux.network.NetworkData in project Flux-Networks by SonarSonic.

the class FluxEvents method onWorldSave.

@SubscribeEvent
public void onWorldSave(WorldEvent.Save event) {
    if (event.getWorld().isRemote) {
        return;
    }
    if (event.getWorld().provider.getDimension() == FluxNetworks.saveDimension) {
        MapStorage storage = event.getWorld().getPerWorldStorage();
        NetworkData data = (NetworkData) storage.getOrLoadData(NetworkData.class, NetworkData.tag);
        if (data == null && !FluxNetworks.getServerCache().getAllNetworks().isEmpty()) {
            storage.setData(NetworkData.tag, new NetworkData(NetworkData.tag));
        }
    }
}
Also used : MapStorage(net.minecraft.world.storage.MapStorage) NetworkData(sonar.flux.network.NetworkData) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

MapStorage (net.minecraft.world.storage.MapStorage)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1 NetworkData (sonar.flux.network.NetworkData)1