1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-17 19:00:03 +00:00
CC-Tweaked/src/main/java/dan200/computercraft/client/ClientHooks.java
Jonathan Coates 0f6db63020
Remove "*Proxy" classes
- Move registry code into the various *Registry classes.

   I'm not sure this is any more sensible, but things being registered
   in different places kinda irked me.

 - Everything else (i.e. event listeners) goes in a {Client,Common}Hooks
   class right now. It's not ideal, but I don't think we can split it up
   much.
2021-06-05 10:09:28 +01:00

40 lines
1.2 KiB
Java

/*
* This file is part of ComputerCraft - http://www.computercraft.info
* Copyright Daniel Ratcliffe, 2011-2021. Do not distribute without permission.
* Send enquiries to dratcliffe@gmail.com
*/
package dan200.computercraft.client;
import dan200.computercraft.ComputerCraft;
import dan200.computercraft.shared.peripheral.monitor.ClientMonitor;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@Mod.EventBusSubscriber( modid = ComputerCraft.MOD_ID, value = Dist.CLIENT )
public class ClientHooks
{
@SubscribeEvent
public static void onWorldUnload( WorldEvent.Unload event )
{
if( event.getWorld().isClientSide() )
{
ClientMonitor.destroyAll();
}
}
@SubscribeEvent
public static void onLogIn( ClientPlayerNetworkEvent.LoggedInEvent event )
{
ComputerCraft.clientComputerRegistry.reset();
}
@SubscribeEvent
public static void onLogOut( ClientPlayerNetworkEvent.LoggedOutEvent event )
{
ComputerCraft.clientComputerRegistry.reset();
}
}