basic inits
This commit is contained in:
1 parent
394891ab5f
commit
ec66779474
8 files changed
+93
-10
No files matched your search
@@ -44,7 +44,6 @@ public class CarpetServer // static for now - easier to handle all around the co
|
|||||||
|
|
||||||
public static void tick(MinecraftServer server)
|
public static void tick(MinecraftServer server)
|
||||||
{
|
{
|
||||||
CarpetSettings.LOG.error("ticking...");
|
|
||||||
//TickSpeed.tick(server);
|
//TickSpeed.tick(server);
|
||||||
//HUDController.update_hud(server);
|
//HUDController.update_hud(server);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ public class CarpetSettings
|
|||||||
|
|
||||||
private static void notifyPlayersCommandsChanged()
|
private static void notifyPlayersCommandsChanged()
|
||||||
{
|
{
|
||||||
if (CarpetServer.minecraft_server == null)
|
if (CarpetServer.minecraft_server == null || CarpetServer.minecraft_server.getPlayerManager() == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins.carpetServer;
|
||||||
|
|
||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
import com.mojang.brigadier.CommandDispatcher;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package carpet.mixins.carpetServer;
|
||||||
|
|
||||||
|
import carpet.CarpetServer;
|
||||||
|
import net.minecraft.server.integrated.IntegratedServer;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(IntegratedServer.class)
|
||||||
|
public class IntegratedServerMixin
|
||||||
|
{
|
||||||
|
@Inject(method = "setupServer",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
shift = At.Shift.AFTER,
|
||||||
|
target = "Lnet/minecraft/server/integrated/IntegratedServer;setKeyPair(Ljava/security/KeyPair;)V"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private void onSetupServerIntegrated(CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
CarpetServer.onServerLoaded((IntegratedServer) (Object) this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package carpet.mixins.carpetServer;
|
||||||
|
|
||||||
|
import carpet.CarpetServer;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
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(MinecraftClient.class)
|
||||||
|
public class MinecraftClientMixin
|
||||||
|
{
|
||||||
|
//to inject right before
|
||||||
|
// this.tickWorlds(booleanSupplier_1);
|
||||||
|
@Inject(method = "init", at = @At(value = "RETURN")
|
||||||
|
)
|
||||||
|
private void onInit(CallbackInfo ci) {
|
||||||
|
//CM start game hook
|
||||||
|
CarpetServer.onGameStarted();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package carpet.mixins.carpetServer;
|
||||||
|
|
||||||
|
import carpet.CarpetServer;
|
||||||
|
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||||
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Mixin(MinecraftDedicatedServer.class)
|
||||||
|
public class MinecraftDedicatedServerMixin
|
||||||
|
{
|
||||||
|
//to inject right before
|
||||||
|
// this.tickWorlds(booleanSupplier_1);
|
||||||
|
@Inject(
|
||||||
|
method = "setupServer",
|
||||||
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/util/UserCache;setUseRemote(Z)V",
|
||||||
|
shift = At.Shift.AFTER,
|
||||||
|
ordinal = 0
|
||||||
|
)
|
||||||
|
)
|
||||||
|
private void onSetupServer(CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
//CM init - all stuff loaded from the server, just before worlds loading
|
||||||
|
CarpetServer.onServerLoaded((MinecraftDedicatedServer) (Object) this);
|
||||||
|
//CM start game hook
|
||||||
|
CarpetServer.onGameStarted();
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-5
@@ -1,4 +1,4 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins.carpetServer;
|
||||||
|
|
||||||
import carpet.CarpetServer;
|
import carpet.CarpetServer;
|
||||||
import com.mojang.authlib.GameProfileRepository;
|
import com.mojang.authlib.GameProfileRepository;
|
||||||
@@ -21,22 +21,27 @@ import java.util.function.BooleanSupplier;
|
|||||||
@Mixin(MinecraftServer.class)
|
@Mixin(MinecraftServer.class)
|
||||||
public abstract class MinecraftServerMixin
|
public abstract class MinecraftServerMixin
|
||||||
{
|
{
|
||||||
// Called during game start
|
@Inject(method = "<init>", at = @At(value = "RETURN"))
|
||||||
@Inject(method = "<init>", at = @At(value = "HEAD"))
|
|
||||||
private void onMinecraftServerCTOR(File file_1, Proxy proxy_1, DataFixer dataFixer_1,
|
private void onMinecraftServerCTOR(File file_1, Proxy proxy_1, DataFixer dataFixer_1,
|
||||||
CommandManager serverCommandManager_1, YggdrasilAuthenticationService yggdrasilAuthenticationService_1,
|
CommandManager serverCommandManager_1, YggdrasilAuthenticationService yggdrasilAuthenticationService_1,
|
||||||
MinecraftSessionService minecraftSessionService_1, GameProfileRepository gameProfileRepository_1,
|
MinecraftSessionService minecraftSessionService_1, GameProfileRepository gameProfileRepository_1,
|
||||||
UserCache userCache_1, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory_1,
|
UserCache userCache_1, WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory_1,
|
||||||
String string_1, CallbackInfo ci)
|
String string_1, CallbackInfo ci)
|
||||||
{
|
{
|
||||||
|
// Called during game start
|
||||||
CarpetServer.init((MinecraftServer) (Object) this);
|
CarpetServer.init((MinecraftServer) (Object) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
//to inject right before
|
//to inject right before
|
||||||
// this.tickWorlds(booleanSupplier_1);
|
// this.tickWorlds(booleanSupplier_1);
|
||||||
@Inject(
|
@Inject(
|
||||||
method = "Lnet/minecraft/server/MinecraftServer;tick(Ljava/util/function/BooleanSupplier;)V",
|
method = "tick",
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;tickWorlds(Ljava/util/function/BooleanSupplier;)V", shift = At.Shift.BEFORE, ordinal = 0)
|
at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lnet/minecraft/server/MinecraftServer;tickWorlds(Ljava/util/function/BooleanSupplier;)V",
|
||||||
|
shift = At.Shift.BEFORE,
|
||||||
|
ordinal = 0
|
||||||
|
)
|
||||||
)
|
)
|
||||||
private void onTick(BooleanSupplier booleanSupplier_1, CallbackInfo ci) {
|
private void onTick(BooleanSupplier booleanSupplier_1, CallbackInfo ci) {
|
||||||
CarpetServer.tick((MinecraftServer) (Object) this);
|
CarpetServer.tick((MinecraftServer) (Object) this);
|
||||||
@@ -3,10 +3,15 @@
|
|||||||
"package": "carpet.mixins",
|
"package": "carpet.mixins",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"CommandManagerMixin"
|
"carpetServer/CommandManagerMixin",
|
||||||
|
"carpetServer/MinecraftServerMixin"
|
||||||
],
|
],
|
||||||
"client": [
|
"client": [
|
||||||
"CommandManagerMixin"
|
"carpetServer/MinecraftClientMixin",
|
||||||
|
"carpetServer/IntegratedServerMixin"
|
||||||
|
],
|
||||||
|
"server": [
|
||||||
|
"carpetServer/MinecraftDedicatedServerMixin"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
Reference in new issue
Block a user