Implement missing events for SDLink

This commit is contained in:
2023-06-08 22:58:02 +02:00
parent 2fb2d216cb
commit c7db867b4b
4 changed files with 114 additions and 1 deletions

View File

@@ -1,9 +1,14 @@
package com.hypherionmc.craterlib.common;
import com.hypherionmc.craterlib.CraterConstants;
import com.hypherionmc.craterlib.api.event.server.CraterRegisterCommandEvent;
import com.hypherionmc.craterlib.api.event.server.CraterServerLifecycleEvent;
import com.hypherionmc.craterlib.core.event.CraterEventBus;
import com.hypherionmc.craterlib.core.systems.internal.CreativeTabRegistry;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.event.RegisterCommandsEvent;
import net.minecraftforge.event.server.*;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
@@ -19,4 +24,28 @@ public class ForgeCommonEvents {
.forEach(itemPair -> event.accept(itemPair.getRight()));
}
@SubscribeEvent
public static void serverStarting(ServerStartingEvent event) {
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Starting(event.getServer()));
}
@SubscribeEvent
public static void serverStarted(ServerStartedEvent event) {
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Started());
}
@SubscribeEvent
public static void serverStopping(ServerStoppingEvent event) {
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Stopping());
}
@SubscribeEvent
public static void serverStopped(ServerStoppedEvent event) {
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Stopped());
}
@SubscribeEvent
public void onCommandRegister(RegisterCommandsEvent event) {
CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(event.getDispatcher()));
}
}