Skip to content

Commit ee90a2e

Browse files
committed
fix some mixins
1 parent fdca736 commit ee90a2e

File tree

10 files changed

+47
-33
lines changed

10 files changed

+47
-33
lines changed

common/src/main/java/dev/isxander/debugify/client/utils/ConfigGuiHelper.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import me.shedaniel.clothconfig2.impl.builders.BooleanToggleBuilder;
1111
import me.shedaniel.clothconfig2.impl.builders.SubCategoryBuilder;
1212
import net.minecraft.client.gui.screen.Screen;
13-
import net.minecraft.text.LiteralText;
13+
import net.minecraft.text.Text;
1414
import net.minecraft.util.Formatting;
1515

1616
import java.util.HashMap;
@@ -21,21 +21,21 @@
2121
public class ConfigGuiHelper {
2222
public static Screen createConfigGui(DebugifyConfig config, Screen parent) {
2323
ConfigBuilder builder = ConfigBuilder.create()
24-
.setTitle(new LiteralText("Debugify"))
24+
.setTitle(Text.literal("Debugify"))
2525
.setSavingRunnable(config::save)
2626
.setParentScreen(parent);
2727

2828
Map<FixCategory, ConfigCategory> fixCategories = new HashMap<>();
2929
Map<ConfigCategory, Map<BugFix.Env, SubCategoryBuilder>> fixSubCategories = new HashMap<>();
3030
for (FixCategory fixCategory : FixCategory.values()) {
31-
var configCategory = builder.getOrCreateCategory(new LiteralText(fixCategory.getDisplayName()));
31+
var configCategory = builder.getOrCreateCategory(Text.literal(fixCategory.getDisplayName()));
3232
if (fixCategory == FixCategory.GAMEPLAY) {
3333
configCategory.addEntry(builder.entryBuilder()
34-
.startTextDescription(new LiteralText("WARNING: This category contains fixes that may be an unfair advantage!").formatted(Formatting.RED))
34+
.startTextDescription(Text.literal("WARNING: This category contains fixes that may be an unfair advantage!").formatted(Formatting.RED))
3535
.build()
3636
);
3737
configCategory.addEntry(builder.entryBuilder()
38-
.startBooleanToggle(new LiteralText("Enable In Multiplayer"), config.gameplayFixesInMultiplayer)
38+
.startBooleanToggle(Text.literal("Enable In Multiplayer"), config.gameplayFixesInMultiplayer)
3939
.setSaveConsumer((enabled) -> config.gameplayFixesInMultiplayer = enabled)
4040
.build()
4141
);
@@ -45,7 +45,7 @@ public static Screen createConfigGui(DebugifyConfig config, Screen parent) {
4545

4646
Map<BugFix.Env, SubCategoryBuilder> subCategories = new HashMap<>();
4747
for (BugFix.Env env : BugFix.Env.values()) {
48-
var subCategoryBuilder = builder.entryBuilder().startSubCategory(new LiteralText(env.getDisplayName()));
48+
var subCategoryBuilder = builder.entryBuilder().startSubCategory(Text.literal(env.getDisplayName()));
4949
subCategories.put(env, subCategoryBuilder);
5050
}
5151
fixSubCategories.put(configCategory, subCategories);
@@ -55,38 +55,38 @@ public static Screen createConfigGui(DebugifyConfig config, Screen parent) {
5555
SubCategoryBuilder subcategory = fixSubCategories.get(fixCategories.get(bug.category())).get(bug.env());
5656

5757
BooleanToggleBuilder entry = builder.entryBuilder()
58-
.startBooleanToggle(new LiteralText(bug.bugId()), enabled)
58+
.startBooleanToggle(Text.literal(bug.bugId()), enabled)
5959
.setSaveConsumer((toggled) -> config.getBugFixes().replace(bug, toggled))
6060
.setDefaultValue(true)
6161
.setErrorSupplier((b) -> {
6262
List<String> conflicts = bug.getActiveConflicts();
6363
if (!b || conflicts.isEmpty())
6464
return Optional.empty();
6565

66-
return Optional.of(new LiteralText(bug.bugId() + " is conflicting with " + (conflicts.size() == 1 ? conflicts.get(0) : "mods " + String.join(", ", conflicts))));
66+
return Optional.of(Text.literal(bug.bugId() + " is conflicting with " + (conflicts.size() == 1 ? conflicts.get(0) : "mods " + String.join(", ", conflicts))));
6767
})
6868
.requireRestart();
6969

7070
if (DebugifyClient.bugFixDescriptionCache.has(bug.bugId()))
71-
entry.setTooltip(new LiteralText(DebugifyClient.bugFixDescriptionCache.get(bug.bugId())));
71+
entry.setTooltip(Text.literal(DebugifyClient.bugFixDescriptionCache.get(bug.bugId())));
7272

7373
subcategory.add(entry.build());
7474
});
7575
fixSubCategories.forEach((category, subCategories) ->
7676
subCategories.forEach((env, subCategoryBuilder) -> category.addEntry(subCategoryBuilder.build())));
7777

78-
ConfigCategory miscCategory = builder.getOrCreateCategory(new LiteralText("Misc"));
78+
ConfigCategory miscCategory = builder.getOrCreateCategory(Text.literal("Misc"));
7979
AbstractConfigListEntry<?> optOutUpdaterEntry = builder.entryBuilder()
80-
.startBooleanToggle(new LiteralText("Opt Out Updater"), config.optOutUpdater)
81-
.setTooltip(new LiteralText("Stop Debugify checking for updates on launch."))
80+
.startBooleanToggle(Text.literal("Opt Out Updater"), config.optOutUpdater)
81+
.setTooltip(Text.literal("Stop Debugify checking for updates on launch."))
8282
.setSaveConsumer((toggled) -> config.optOutUpdater = toggled)
8383
.setDefaultValue(false)
8484
.build();
8585
miscCategory.addEntry(optOutUpdaterEntry);
8686

8787
AbstractConfigListEntry<?> defaultDisabledEntry = builder.entryBuilder()
88-
.startBooleanToggle(new LiteralText("Default to Disabled"), config.defaultDisabled)
89-
.setTooltip(new LiteralText("Default new bug fixes to be disabled rather than enabled."))
88+
.startBooleanToggle(Text.literal("Default to Disabled"), config.defaultDisabled)
89+
.setTooltip(Text.literal("Default new bug fixes to be disabled rather than enabled."))
9090
.setSaveConsumer((toggled) -> config.defaultDisabled = toggled)
9191
.setDefaultValue(false)
9292
.build();

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc119417/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import dev.isxander.debugify.fixes.FixCategory;
55
import com.mojang.authlib.GameProfile;
66
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.network.encryption.PlayerPublicKey;
78
import net.minecraft.server.network.ServerPlayerEntity;
89
import net.minecraft.util.math.BlockPos;
910
import net.minecraft.world.GameMode;
1011
import net.minecraft.world.World;
12+
import org.jetbrains.annotations.Nullable;
1113
import org.spongepowered.asm.mixin.Mixin;
1214
import org.spongepowered.asm.mixin.injection.At;
1315
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,8 +18,8 @@
1618
@BugFix(id = "MC-119417", category = FixCategory.BASIC, env = BugFix.Env.SERVER)
1719
@Mixin(ServerPlayerEntity.class)
1820
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
19-
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) {
20-
super(world, pos, yaw, profile);
21+
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
22+
super(world, pos, yaw, gameProfile, publicKey);
2123
}
2224

2325
@Inject(method = "changeGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V"))

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc124177/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
import com.mojang.authlib.GameProfile;
66
import net.minecraft.entity.effect.StatusEffectInstance;
77
import net.minecraft.entity.player.PlayerEntity;
8+
import net.minecraft.network.encryption.PlayerPublicKey;
89
import net.minecraft.network.packet.s2c.play.EntityStatusEffectS2CPacket;
910
import net.minecraft.network.packet.s2c.play.ExperienceBarUpdateS2CPacket;
1011
import net.minecraft.network.packet.s2c.play.PlayerAbilitiesS2CPacket;
1112
import net.minecraft.server.network.ServerPlayNetworkHandler;
1213
import net.minecraft.server.network.ServerPlayerEntity;
1314
import net.minecraft.util.math.BlockPos;
1415
import net.minecraft.world.World;
16+
import org.jetbrains.annotations.Nullable;
1517
import org.spongepowered.asm.mixin.Mixin;
1618
import org.spongepowered.asm.mixin.Shadow;
1719
import org.spongepowered.asm.mixin.injection.At;
@@ -23,8 +25,8 @@
2325
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
2426
@Shadow public ServerPlayNetworkHandler networkHandler;
2527

26-
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) {
27-
super(world, pos, yaw, profile);
28+
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
29+
super(world, pos, yaw, gameProfile, publicKey);
2830
}
2931

3032
@Inject(method = "teleport", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/server/PlayerManager;sendPlayerStatus(Lnet/minecraft/server/network/ServerPlayerEntity;)V"))

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc129909/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import dev.isxander.debugify.fixes.FixCategory;
55
import com.mojang.authlib.GameProfile;
66
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.network.encryption.PlayerPublicKey;
78
import net.minecraft.server.network.ServerPlayerEntity;
89
import net.minecraft.util.math.BlockPos;
910
import net.minecraft.world.GameMode;
1011
import net.minecraft.world.World;
12+
import org.jetbrains.annotations.Nullable;
1113
import org.spongepowered.asm.mixin.Mixin;
1214
import org.spongepowered.asm.mixin.injection.At;
1315
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,8 +18,8 @@
1618
@BugFix(id = "MC-129909", category = FixCategory.BASIC, env = BugFix.Env.SERVER)
1719
@Mixin(ServerPlayerEntity.class)
1820
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
19-
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) {
20-
super(world, pos, yaw, profile);
21+
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
22+
super(world, pos, yaw, gameProfile, publicKey);
2123
}
2224

2325
/**

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc14923/ServerPlayNetworkHandlerMixin.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package dev.isxander.debugify.mixins.basic.server.mc14923;
22

3+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
34
import dev.isxander.debugify.fixes.BugFix;
45
import dev.isxander.debugify.fixes.FixCategory;
56
import net.minecraft.server.MinecraftServer;
@@ -25,10 +26,8 @@ public class ServerPlayNetworkHandlerMixin {
2526
* but in singleplayer, with cheats off, you are not opped.
2627
* This mixin also checks if the user is the host.
2728
*/
28-
@Inject(method = "handleMessage", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayNetworkHandler;disconnect(Lnet/minecraft/text/Text;)V"), cancellable = true)
29-
public void onMessage(TextStream.Message message, CallbackInfo ci){
30-
if (this.server.isHost(this.player.getGameProfile())) {
31-
ci.cancel();
32-
}
29+
@ModifyExpressionValue(method = "checkForSpam", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/PlayerManager;isOperator(Lcom/mojang/authlib/GameProfile;)Z"))
30+
public boolean onMessage(boolean operator){
31+
return operator || this.server.isHost(this.player.getGameProfile());
3332
}
3433
}

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc215530/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import dev.isxander.debugify.fixes.FixCategory;
55
import com.mojang.authlib.GameProfile;
66
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.network.encryption.PlayerPublicKey;
78
import net.minecraft.server.network.ServerPlayerEntity;
89
import net.minecraft.util.math.BlockPos;
910
import net.minecraft.world.GameMode;
1011
import net.minecraft.world.World;
12+
import org.jetbrains.annotations.Nullable;
1113
import org.spongepowered.asm.mixin.Mixin;
1214
import org.spongepowered.asm.mixin.injection.At;
1315
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,8 +18,8 @@
1618
@BugFix(id = "MC-215530", category = FixCategory.BASIC, env = BugFix.Env.SERVER)
1719
@Mixin(ServerPlayerEntity.class)
1820
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
19-
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) {
20-
super(world, pos, yaw, profile);
21+
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
22+
super(world, pos, yaw, gameProfile, publicKey);
2123
}
2224

2325
@Inject(method = "changeGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V"))

common/src/main/java/dev/isxander/debugify/mixins/basic/server/mc69216/ServerPlayerEntityMixin.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
import dev.isxander.debugify.fixes.FixCategory;
55
import com.mojang.authlib.GameProfile;
66
import net.minecraft.entity.player.PlayerEntity;
7+
import net.minecraft.network.encryption.PlayerPublicKey;
78
import net.minecraft.server.network.ServerPlayerEntity;
89
import net.minecraft.util.math.BlockPos;
910
import net.minecraft.world.GameMode;
1011
import net.minecraft.world.World;
12+
import org.jetbrains.annotations.Nullable;
1113
import org.spongepowered.asm.mixin.Mixin;
1214
import org.spongepowered.asm.mixin.injection.At;
1315
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,8 +18,8 @@
1618
@BugFix(id = "MC-69216", category = FixCategory.BASIC, env = BugFix.Env.SERVER)
1719
@Mixin(ServerPlayerEntity.class)
1820
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
19-
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile profile) {
20-
super(world, pos, yaw, profile);
21+
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile, @Nullable PlayerPublicKey publicKey) {
22+
super(world, pos, yaw, gameProfile, publicKey);
2123
}
2224

2325
@Inject(method = "changeGameMode", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;stopRiding()V"))

fabric/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ dependencies {
4747
exclude(module = "fabric-api")
4848
}
4949

50-
modImplementation("com.terraformersmc:modmenu:3.+")
50+
modImplementation("com.terraformersmc:modmenu:4.+") {
51+
exclude(module = "fabric-api")
52+
}
53+
54+
modRuntimeOnly("net.fabricmc.fabric-api:fabric-api:0.55.0+1.19")
5155
}
5256

5357
tasks {

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"java": ">=17"
3838
},
3939
"recommends": {
40-
"cloth-config2": "6.x.x",
40+
"cloth-config2": "7.x.x",
4141
"modmenu": "*"
4242
},
4343
"conflicts": {

forge/src/main/java/dev/isxander/debugify/forge/mixins/basic/client/mc215531/ForgeIngameGuiMixin.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
66
import net.minecraft.client.MinecraftClient;
77
import net.minecraft.client.gui.hud.InGameHud;
8+
import net.minecraft.client.render.item.ItemRenderer;
89
import net.minecraftforge.client.gui.ForgeIngameGui;
910
import org.spongepowered.asm.mixin.Mixin;
1011
import org.spongepowered.asm.mixin.injection.At;
1112

1213
@BugFix(id = "MC-215531", category = FixCategory.BASIC, env = BugFix.Env.CLIENT)
1314
@Mixin(ForgeIngameGui.class)
1415
public class ForgeIngameGuiMixin extends InGameHud {
15-
public ForgeIngameGuiMixin(MinecraftClient client) {
16-
super(client);
16+
public ForgeIngameGuiMixin(MinecraftClient client, ItemRenderer itemRenderer) {
17+
super(client, itemRenderer);
1718
}
1819

1920
/**

0 commit comments

Comments
 (0)