Final updates before first release
This commit is contained in:
@@ -2,9 +2,11 @@ package com.hypherionmc.craterlib;
|
||||
|
||||
import com.hypherionmc.craterlib.api.event.client.LateInitEvent;
|
||||
import com.hypherionmc.craterlib.client.CraterClientBus;
|
||||
import com.hypherionmc.craterlib.common.ForgeServerEvents;
|
||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@@ -13,7 +15,7 @@ public class CraterLib {
|
||||
|
||||
public CraterLib() {
|
||||
CraterEventBus.INSTANCE.registerEventListener(CraterClientBus.class);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new ForgeServerEvents());
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
LateInitEvent event = new LateInitEvent(Minecraft.getInstance(), Minecraft.getInstance().options);
|
||||
CraterEventBus.INSTANCE.postEvent(event);
|
||||
|
@@ -1,14 +1,9 @@
|
||||
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;
|
||||
|
||||
@@ -23,29 +18,4 @@ public class ForgeCommonEvents {
|
||||
.filter(p -> p.getLeft().get() == tab && p.getRight() != null)
|
||||
.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()));
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,40 @@
|
||||
package com.hypherionmc.craterlib.common;
|
||||
|
||||
import com.hypherionmc.craterlib.api.event.server.CraterRegisterCommandEvent;
|
||||
import com.hypherionmc.craterlib.api.event.server.CraterServerLifecycleEvent;
|
||||
import com.hypherionmc.craterlib.core.event.CraterEventBus;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||
import net.minecraftforge.event.server.ServerStartingEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppedEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
public class ForgeServerEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStarting(ServerStartingEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Starting(event.getServer()));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStarted(ServerStartedEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Started());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStopping(ServerStoppingEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Stopping());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStopped(ServerStoppedEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(new CraterServerLifecycleEvent.Stopped());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCommandRegister(RegisterCommandsEvent event) {
|
||||
CraterEventBus.INSTANCE.postEvent(new CraterRegisterCommandEvent(event.getDispatcher()));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user