use of org.spongepowered.api.event.world.SaveWorldEvent in project SpongeForge by SpongePowered.
the class SpongeForgeEventFactory method callWorldSaveEvent.
private static SaveWorldEvent callWorldSaveEvent(Event event) {
SaveWorldEvent spongeEvent = (SaveWorldEvent) event;
// Since Forge only uses a single save handler, we need to make sure to pass the overworld's handler.
// This makes sure that mods dont attempt to save/read their data from the wrong location.
((IMixinWorld) spongeEvent.getTargetWorld()).setCallingWorldEvent(true);
((IMixinEventBus) MinecraftForge.EVENT_BUS).post(new WorldEvent.Save((net.minecraft.world.World) spongeEvent.getTargetWorld()), true);
((IMixinWorld) spongeEvent.getTargetWorld()).setCallingWorldEvent(false);
return spongeEvent;
}
Aggregations