From 97be59a7b6b990e8a68b69424904ed465a1faabe Mon Sep 17 00:00:00 2001 From: Anhgelus Morhtuuzh Date: Mon, 16 Mar 2026 22:14:20 +0100 Subject: feat(): support 26.1 --- .../anhgelus/molehunt/client/MolehuntClient.java | 16 ++++++++-------- .../client/mixin/NoCustomizableSkinOverlay.java | 14 +++++++------- .../anhgelus/molehunt/client/mixin/NoNametags.java | 22 +++++++++------------- .../molehunt/client/mixin/NoPlayerListHud.java | 6 +++--- .../anhgelus/molehunt/client/mixin/NoSkin.java | 21 +++++++++++---------- 5 files changed, 38 insertions(+), 41 deletions(-) (limited to 'src/client') diff --git a/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java b/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java index 03198ee..b0ef344 100644 --- a/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java +++ b/src/client/java/world/anhgelus/molehunt/client/MolehuntClient.java @@ -3,7 +3,7 @@ package world.anhgelus.molehunt.client; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; -import net.minecraft.entity.player.PlayerModelPart; +import net.minecraft.world.entity.player.PlayerModelPart; import world.anhgelus.molehunt.config.ConfigPayload; import world.anhgelus.molehunt.game.GamePayload; @@ -28,13 +28,13 @@ public class MolehuntClient implements ClientModInitializer { ClientLifecycleEvents.CLIENT_STARTED.register(client -> { var options = client.options; - options.setPlayerModelPart(PlayerModelPart.CAPE, true); - options.setPlayerModelPart(PlayerModelPart.HAT, true); - options.setPlayerModelPart(PlayerModelPart.JACKET, true); - options.setPlayerModelPart(PlayerModelPart.LEFT_SLEEVE, true); - options.setPlayerModelPart(PlayerModelPart.RIGHT_SLEEVE, true); - options.setPlayerModelPart(PlayerModelPart.LEFT_PANTS_LEG, true); - options.setPlayerModelPart(PlayerModelPart.RIGHT_PANTS_LEG, true); + options.setModelPart(PlayerModelPart.CAPE, true); + options.setModelPart(PlayerModelPart.HAT, true); + options.setModelPart(PlayerModelPart.JACKET, true); + options.setModelPart(PlayerModelPart.LEFT_SLEEVE, true); + options.setModelPart(PlayerModelPart.RIGHT_SLEEVE, true); + options.setModelPart(PlayerModelPart.LEFT_PANTS_LEG, true); + options.setModelPart(PlayerModelPart.RIGHT_PANTS_LEG, true); }); } diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoCustomizableSkinOverlay.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoCustomizableSkinOverlay.java index c2c0ab0..af299ea 100644 --- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoCustomizableSkinOverlay.java +++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoCustomizableSkinOverlay.java @@ -1,7 +1,7 @@ package world.anhgelus.molehunt.client.mixin; -import net.minecraft.client.option.GameOptions; -import net.minecraft.entity.player.PlayerModelPart; +import net.minecraft.client.Options; +import net.minecraft.world.entity.player.PlayerModelPart; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -9,16 +9,16 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import world.anhgelus.molehunt.client.MolehuntClient; -@Mixin(GameOptions.class) +@Mixin(Options.class) public abstract class NoCustomizableSkinOverlay { @Shadow - private void setPlayerModelPart(PlayerModelPart part, boolean enabled) {} + public void setModelPart(PlayerModelPart part, boolean enabled) {} - @Inject(at = @At("HEAD"), method = "setPlayerModelPart", cancellable = true) + @Inject(at = @At("HEAD"), method = "setModelPart", cancellable = true) public void togglePlayerModelPart(PlayerModelPart part, boolean enabled, CallbackInfo ci) { if (MolehuntClient.showSkins()) return; - setPlayerModelPart(part, true); - ((GameOptions) (Object) this).sendClientSettings(); + setModelPart(part, true); + ((Options) (Object) this).broadcastOptions(); ci.cancel(); } } diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java index 555fb00..937f45e 100644 --- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java +++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoNametags.java @@ -1,24 +1,20 @@ package world.anhgelus.molehunt.client.mixin; -import net.minecraft.client.render.command.OrderedRenderCommandQueue; -import net.minecraft.client.render.entity.EntityRenderer; -import net.minecraft.client.render.entity.state.EntityRenderState; -import net.minecraft.client.render.state.CameraRenderState; -import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.state.EntityRenderState; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.player.Player; 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; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import world.anhgelus.molehunt.client.MolehuntClient; @Mixin(EntityRenderer.class) public class NoNametags { - @Inject(at = @At("HEAD"), method = "render", cancellable = true) - private void renderLabelOrNot(S state, MatrixStack matrices, OrderedRenderCommandQueue queue, CameraRenderState cameraState, CallbackInfo ci) { - if (EntityType.PLAYER != state.entityType || MolehuntClient.showNameTags() || !MolehuntClient.gameStarted()) return; - ci.cancel(); + @Inject(at = @At("HEAD"), method = "shouldShowName", cancellable = true) + private void renderLabelOrNot(T entity, double distanceToCameraSq, CallbackInfoReturnable cir) { + if (!(entity instanceof Player) || MolehuntClient.showNameTags() || !MolehuntClient.gameStarted()) return; + cir.setReturnValue(false); } } \ No newline at end of file diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java index 4473b12..c235b00 100644 --- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java +++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoPlayerListHud.java @@ -1,15 +1,15 @@ package world.anhgelus.molehunt.client.mixin; -import net.minecraft.client.gui.hud.PlayerListHud; +import net.minecraft.client.gui.components.PlayerTabOverlay; 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; import world.anhgelus.molehunt.client.MolehuntClient; -@Mixin(PlayerListHud.class) +@Mixin(PlayerTabOverlay.class) public class NoPlayerListHud { - @Inject(at = @At("HEAD"), method = "render", cancellable = true) + @Inject(at = @At("HEAD"), method = "setVisible", cancellable = true) public void render(CallbackInfo ci) { if (MolehuntClient.showTab() || !MolehuntClient.gameStarted()) return; ci.cancel(); diff --git a/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java b/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java index b6b67cc..fd5a8a1 100644 --- a/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java +++ b/src/client/java/world/anhgelus/molehunt/client/mixin/NoSkin.java @@ -1,10 +1,10 @@ package world.anhgelus.molehunt.client.mixin; -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.entity.player.PlayerSkinType; -import net.minecraft.entity.player.SkinTextures; -import net.minecraft.util.AssetInfo; -import net.minecraft.util.Identifier; +import net.minecraft.client.player.AbstractClientPlayer; +import net.minecraft.core.ClientAsset; +import net.minecraft.resources.Identifier; +import net.minecraft.world.entity.player.PlayerModelType; +import net.minecraft.world.entity.player.PlayerSkin; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -12,16 +12,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import world.anhgelus.molehunt.Molehunt; import world.anhgelus.molehunt.client.MolehuntClient; -@Mixin(AbstractClientPlayerEntity.class) +@Mixin(AbstractClientPlayer.class) public class NoSkin { @Inject(at = @At("HEAD"), method = "getSkin", cancellable = true) - public void getSkin(CallbackInfoReturnable cir) { + public void getSkin(CallbackInfoReturnable cir) { if (MolehuntClient.showSkins() || !MolehuntClient.gameStarted()) return; - cir.setReturnValue(SkinTextures.create( - new AssetInfo.TextureAssetInfo(Identifier.of(Molehunt.MOD_ID, "skin")), + cir.setReturnValue(new PlayerSkin( + new ClientAsset.ResourceTexture(Identifier.fromNamespaceAndPath(Molehunt.MOD_ID, "skin")), null, null, - PlayerSkinType.WIDE + PlayerModelType.WIDE, + true )); } } -- cgit v1.2.3