Change load method to Loader's entrypoints (#497)
* Start moving away from noop mixins Remove the mixin from the json list * Change startup method to Loader entrypoints
This commit is contained in:
1 parent
05a0628530
commit
020866c0e9
4 files changed
+20
-21
No files matched your search
@@ -15,12 +15,15 @@ import carpet.logging.HUDController;
|
|||||||
import carpet.utils.MobAI;
|
import carpet.utils.MobAI;
|
||||||
import carpet.utils.SpawnReporter;
|
import carpet.utils.SpawnReporter;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
|
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.api.DedicatedServerModInitializer;
|
||||||
import net.fabricmc.loader.api.FabricLoader;
|
import net.fabricmc.loader.api.FabricLoader;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
|
||||||
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
public class CarpetServer implements ClientModInitializer,DedicatedServerModInitializer // static for now - easier to handle all around the code, its one anyways
|
||||||
{
|
{
|
||||||
public static final Random rand = new Random();
|
public static final Random rand = new Random();
|
||||||
public static MinecraftServer minecraft_server;
|
public static MinecraftServer minecraft_server;
|
||||||
@@ -29,6 +32,17 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
public static SettingsManager settingsManager;
|
public static SettingsManager settingsManager;
|
||||||
public static final List<CarpetExtension> extensions = new ArrayList<>();
|
public static final List<CarpetExtension> extensions = new ArrayList<>();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onInitializeClient()
|
||||||
|
{
|
||||||
|
CarpetServer.onGameStarted();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void onInitializeServer()
|
||||||
|
{
|
||||||
|
CarpetServer.onGameStarted();
|
||||||
|
}
|
||||||
|
|
||||||
// Separate from onServerLoaded, because a server can be loaded multiple times in singleplayer
|
// Separate from onServerLoaded, because a server can be loaded multiple times in singleplayer
|
||||||
public static void manageExtension(CarpetExtension extension)
|
public static void manageExtension(CarpetExtension extension)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package carpet.mixins;
|
|
||||||
|
|
||||||
import carpet.CarpetServer;
|
|
||||||
import net.minecraft.util.crash.CrashReport;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
@Mixin(CrashReport.class)
|
|
||||||
public class CrashReport_coreMixin
|
|
||||||
{
|
|
||||||
@Inject(method = "initCrashReport", at = @At("RETURN"))
|
|
||||||
private static void gameStarted(CallbackInfo ci)
|
|
||||||
{
|
|
||||||
CarpetServer.onGameStarted();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,6 @@
|
|||||||
"package": "carpet.mixins",
|
"package": "carpet.mixins",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CrashReport_coreMixin",
|
|
||||||
"SpawnHelperInnerMixin",
|
"SpawnHelperInnerMixin",
|
||||||
"CommandManagerMixin",
|
"CommandManagerMixin",
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"client": [
|
||||||
|
"carpet.CarpetServer"
|
||||||
|
],
|
||||||
|
"server": [
|
||||||
|
"carpet.CarpetServer"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|||||||
Reference in new issue
Block a user