Compact fabric initialization code (#918)
This commit is contained in:
1 parent
d29adf3a48
commit
1a92531554
2 files changed
+6
-15
No files matched your search
@@ -1,6 +1,5 @@
|
|||||||
package carpet;
|
package carpet;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -37,8 +36,11 @@ 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 implements ClientModInitializer,DedicatedServerModInitializer // static for now - easier to handle all around the code, its one anyways
|
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
||||||
{
|
{
|
||||||
|
public static final ClientModInitializer CLIENT_INITIALIZER = CarpetServer::onGameStarted;
|
||||||
|
public static final DedicatedServerModInitializer SERVER_INITIALIZER = CarpetServer::onGameStarted;
|
||||||
|
|
||||||
public static final Random rand = new Random();
|
public static final Random rand = new Random();
|
||||||
public static MinecraftServer minecraft_server;
|
public static MinecraftServer minecraft_server;
|
||||||
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
||||||
@@ -46,17 +48,6 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
|||||||
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
|
||||||
/**
|
/**
|
||||||
* Registers a {@link CarpetExtension} to be managed by Carpet.<br>
|
* Registers a {@link CarpetExtension} to be managed by Carpet.<br>
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"carpet.CarpetServer"
|
"carpet.CarpetServer::CLIENT_INITIALIZER"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
"carpet.CarpetServer"
|
"carpet.CarpetServer::SERVER_INITIALIZER"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|||||||
Reference in new issue
Block a user