Java Code Examples for net.minecraftforge.event.world.WorldEvent#Save

The following examples show how to use net.minecraftforge.event.world.WorldEvent#Save . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ForgeMod.java    From BlueMap with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onWorldSave(WorldEvent.Save evt) {
	if (!(evt.getWorld() instanceof ServerWorld)) return;
	
	try {
		UUID world = getUUIDForWorld((ServerWorld) evt.getWorld());
		
		for (ServerEventListener listener : eventListeners) listener.onWorldSaveToDisk(world);
		
	} catch (IOException ignore) {}
}
 
Example 2
Source File: PlanetEventHandler.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@SubscribeEvent
public void worldSaveEvent(WorldEvent.Save event) {
	//TODO: save only the one dimension
	if(event.getWorld().provider.getDimension() == 0)
		try {
			DimensionManager.getInstance().saveDimensions(DimensionManager.workingPath);
		} catch (Exception e) {
			AdvancedRocketry.logger.fatal("!!!!!!!!!!!!!! An error has occured saving planet data, please report to the mod dev with the entire fml-latest.log file!  This report may contain information relevent to solving a longstanding bug.");
			e.printStackTrace();
		}
}
 
Example 3
Source File: WRCoreEventHandler.java    From WirelessRedstone with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event) {
    if (event.world.isRemote || RedstoneEther.server() == null)
        return;

    RedstoneEther.server().saveEther(event.world);
}
 
Example 4
Source File: WorldExtensionManager.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event)
{
    if(worldMap.containsKey(event.world))
        for(WorldExtension extension : worldMap.get(event.world))
            extension.save();
}
 
Example 5
Source File: EnderStorageManager.java    From EnderStorage with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldSave(WorldEvent.Save event) {
    if (!event.getWorld().isRemote() && instance(false) != null) {
        instance(false).save(false);
    }
}
 
Example 6
Source File: WorldEventHandler.java    From enderutilities with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onWorldSaveEvent(WorldEvent.Save event)
{
    EnergyBridgeTracker.writeToDisk();
    PlacementProperties.getInstance().writeToDisk();
}