mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-07 12:56:31 +01:00
810191aa89
- Revisited every unchecked TileEntity cast - Redstone Links can now be toggled with a wrench - Redstong Links are now portable on contraptions - Schematicannon no longer inserts held schematics automatically - Saws no longer accept items when their speed is zero
45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package com.simibubi.create;
|
|
|
|
import net.minecraft.world.IWorld;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.event.TickEvent.Phase;
|
|
import net.minecraftforge.event.TickEvent.ServerTickEvent;
|
|
import net.minecraftforge.event.world.WorldEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.fml.DistExecutor;
|
|
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|
import net.minecraftforge.fml.event.server.FMLServerStoppingEvent;
|
|
|
|
@EventBusSubscriber
|
|
public class Events {
|
|
|
|
@SubscribeEvent
|
|
public static void onTick(ServerTickEvent event) {
|
|
if (event.phase == Phase.END)
|
|
return;
|
|
|
|
Create.tick();
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onClose(FMLServerStoppingEvent event) {
|
|
Create.shutdown();
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onLoadWorld(WorldEvent.Load event) {
|
|
IWorld world = event.getWorld();
|
|
Create.redstoneLinkNetworkHandler.onLoadWorld(world);
|
|
Create.torquePropagator.onLoadWorld(world);
|
|
if (event.getWorld().isRemote())
|
|
DistExecutor.runWhenOn(Dist.CLIENT, () -> CreateClient.bufferCache::invalidate);
|
|
}
|
|
|
|
@SubscribeEvent
|
|
public static void onUnloadWorld(WorldEvent.Unload event) {
|
|
IWorld world = event.getWorld();
|
|
Create.redstoneLinkNetworkHandler.onUnloadWorld(world);
|
|
Create.torquePropagator.onUnloadWorld(world);
|
|
}
|
|
|
|
}
|