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

The following examples show how to use net.minecraftforge.event.world.WorldEvent#Unload . 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: TofuNetwork.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@SubscribeEvent
public static void onUnloadWorld(WorldEvent.Unload event) {
    World world = event.getWorld();
    for (String uid : toUUIDs(Instance.getTEWithinDim(world.provider.getDimension()))) {
        //It is a world unload, so isSystem is here to prevent bugs from misdetailed event.
        Instance.unload(uid, true);
    }
}
 
Example 2
Source File: EventHandlerWorld.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void on(WorldEvent.Unload e) {
    if (!e.world.isRemote && e.world.provider.dimensionId == 0) {
        Gadomancy.unloadModData();

        TCMazeHandler.closeAllSessionsAndCleanup();
    }
}
 
Example 3
Source File: LookingGlassForgeEventHandler.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
	if (!event.world.isRemote) return;
	// When we unload a world client side, we want to make sure that any view entities clean up. Not strictly necessary, but a good practice.
	// I don't trust vanilla to unload entity references quickly/correctly/completely.
	for (Object entity : event.world.loadedEntityList) {
		if (entity instanceof EntityPortal) ((EntityPortal) entity).releaseActiveView();
	}
}
 
Example 4
Source File: MatrixNotifications.java    From ForgeHax with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  once = false;
  position = 0;
  
  if (MC.getCurrentServerData() != null) {
    serverName = getServerName();
  }
}
 
Example 5
Source File: CyberwareConfig.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event)
{
	if (event.getWorld().isRemote && !Minecraft.getMinecraft().getConnection().getNetworkManager().isChannelOpen())
	{
		loadConfig();
	}
}
 
Example 6
Source File: EssentialsMissingHandlerClient.java    From Cyberware with MIT License 5 votes vote down vote up
@SubscribeEvent
public void handleWorldUnload(WorldEvent.Unload event)
{
	if (missingArm)
	{
		GameSettings settings = Minecraft.getMinecraft().gameSettings;
		missingArm = false;
		settings.mainHand = oldHand;
	}
}
 
Example 7
Source File: WorldExtensionManager.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
@SubscribeEvent
public void onWorldUnLoad(WorldEvent.Unload event)
{
    if(worldMap.containsKey(event.world))//because force closing unloads a world twice
        for(WorldExtension extension : worldMap.remove(event.world))
            extension.unload();
}
 
Example 8
Source File: FakePlayerPool.java    From OpenModsLib with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload evt) {
	worldPools.remove(evt.getWorld());
}
 
Example 9
Source File: EventHandler.java    From mapwriter with MIT License 4 votes vote down vote up
@SubscribeEvent
public void eventWorldUnload(WorldEvent.Unload event){
    if(event.world.isRemote){
        this.mw.onWorldUnload(event.world);
    }
}
 
Example 10
Source File: ForgeEventHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void worldLoad(WorldEvent.Unload evt) {
	Game.events().publish(new nova.core.event.WorldEvent.Unload(WorldConverter.instance().toNova(evt.world)));
}
 
Example 11
Source File: ForgeEventHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void worldLoad(WorldEvent.Unload evt) {
	Game.events().publish(new nova.core.event.WorldEvent.Unload(WorldConverter.instance().toNova(evt.world)));
}
 
Example 12
Source File: ForgeEventHandler.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void worldLoad(WorldEvent.Unload evt) {
	Game.events().publish(new nova.core.event.WorldEvent.Unload(WorldConverter.instance().toNova(evt.getWorld())));
}
 
Example 13
Source File: TankSynchroniser.java    From EnderStorage with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
    if (!event.getWorld().isRemote() && !ServerUtils.getServer().isServerRunning()) {
        playerItemTankStates = null;
    }
}
 
Example 14
Source File: WorldEventService.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  MinecraftForge.EVENT_BUS.post(new WorldChangeEvent(event.getWorld()));
}
 
Example 15
Source File: LogoutSpot.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  reset();
}
 
Example 16
Source File: BaritoneCompatibility.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  onDisabled();
}
 
Example 17
Source File: AutoReconnectMod.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  updateLastConnectedServer();
}
 
Example 18
Source File: RiderDesync.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  this.dismountedEntity = null;
  this.forceUpdate = false;
}
 
Example 19
Source File: PositionRotationManager.java    From ForgeHax with MIT License 4 votes vote down vote up
@SubscribeEvent
public void onWorldUnload(WorldEvent.Unload event) {
  gState.setInitialized(false);
}
 
Example 20
Source File: TaskScheduler.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public static void onWorldUnload(WorldEvent.Unload event) {
    if(!event.getWorld().isRemote) {
        tasksPerWorld.remove(event.getWorld());
    }
}