aboutsummaryrefslogtreecommitdiff
path: root/src/client/java/world
diff options
context:
space:
mode:
authorAnhgelus Morhtuuzh <william@herges.fr>2026-03-19 14:32:46 +0100
committerAnhgelus Morhtuuzh <william@herges.fr>2026-03-19 14:32:46 +0100
commit095aa12d0cf8170014f59d1e1646311989aaca58 (patch)
tree3af7b4e08aaae82a5bdcf6fbd0bb14b519d1cb27 /src/client/java/world
Copy Molehunt and rename
Diffstat (limited to 'src/client/java/world')
-rw-r--r--src/client/java/world/anhgelus/floodhunt/client/FloodhuntClient.java57
-rw-r--r--src/client/java/world/anhgelus/floodhunt/client/mixin/NoCustomizableSkinOverlay.java18
-rw-r--r--src/client/java/world/anhgelus/floodhunt/client/mixin/NoNametags.java24
-rw-r--r--src/client/java/world/anhgelus/floodhunt/client/mixin/NoPlayerListHud.java17
-rw-r--r--src/client/java/world/anhgelus/floodhunt/client/mixin/NoSkin.java27
5 files changed, 143 insertions, 0 deletions
diff --git a/src/client/java/world/anhgelus/floodhunt/client/FloodhuntClient.java b/src/client/java/world/anhgelus/floodhunt/client/FloodhuntClient.java
new file mode 100644
index 0000000..ab0139e
--- /dev/null
+++ b/src/client/java/world/anhgelus/floodhunt/client/FloodhuntClient.java
@@ -0,0 +1,57 @@
+package world.anhgelus.floodhunt.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 world.anhgelus.floodhunt.config.ConfigPayload;
+import world.anhgelus.floodhunt.game.GamePayload;
+
+public class FloodhuntClient implements ClientModInitializer {
+
+ private static boolean SHOW_SKINS = false;
+ private static boolean SHOW_NAMETAGS = false;
+ private static boolean SHOW_TAB = false;
+
+ private static boolean GAME_STARTED = false;
+
+ public static boolean showSkins() {
+ return SHOW_SKINS;
+ }
+
+ public static boolean showNameTags() {
+ return SHOW_NAMETAGS;
+ }
+
+ public static boolean showTab() {
+ return SHOW_TAB;
+ }
+
+ public static boolean gameStarted() {
+ return GAME_STARTED;
+ }
+
+ @Override
+ public void onInitializeClient() {
+ ClientPlayNetworking.registerGlobalReceiver(ConfigPayload.ID, (payload, context) -> context.client().execute(() -> {
+ SHOW_SKINS = payload.showSkins();
+ SHOW_NAMETAGS = payload.showNametags();
+ SHOW_TAB = payload.showTab();
+ }));
+ ClientPlayNetworking.registerGlobalReceiver(GamePayload.ID, (payload, context) -> context.client().execute(() -> GAME_STARTED = payload.gameLaunched()));
+
+ // Needed because else `client.options` is null
+ 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);
+ });
+
+ }
+}
diff --git a/src/client/java/world/anhgelus/floodhunt/client/mixin/NoCustomizableSkinOverlay.java b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoCustomizableSkinOverlay.java
new file mode 100644
index 0000000..7220308
--- /dev/null
+++ b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoCustomizableSkinOverlay.java
@@ -0,0 +1,18 @@
+package world.anhgelus.floodhunt.client.mixin;
+
+import net.minecraft.client.option.GameOptions;
+import net.minecraft.entity.player.PlayerModelPart;
+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.floodhunt.client.FloodhuntClient;
+
+@Mixin(GameOptions.class)
+public abstract class NoCustomizableSkinOverlay {
+ @Inject(at = @At("HEAD"), method = "setPlayerModelPart", cancellable = true)
+ public void togglePlayerModelPart(PlayerModelPart part, boolean enabled, CallbackInfo ci) {
+ if (FloodhuntClient.showSkins()) return;
+ ci.cancel();
+ }
+}
diff --git a/src/client/java/world/anhgelus/floodhunt/client/mixin/NoNametags.java b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoNametags.java
new file mode 100644
index 0000000..ca75fd8
--- /dev/null
+++ b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoNametags.java
@@ -0,0 +1,24 @@
+package world.anhgelus.floodhunt.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 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.floodhunt.client.FloodhuntClient;
+
+@Mixin(EntityRenderer.class)
+public class NoNametags<T extends Entity, S extends EntityRenderState> {
+ @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 || FloodhuntClient.showNameTags() || !FloodhuntClient.gameStarted())
+ return;
+ ci.cancel();
+ }
+}
diff --git a/src/client/java/world/anhgelus/floodhunt/client/mixin/NoPlayerListHud.java b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoPlayerListHud.java
new file mode 100644
index 0000000..aa2f886
--- /dev/null
+++ b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoPlayerListHud.java
@@ -0,0 +1,17 @@
+package world.anhgelus.floodhunt.client.mixin;
+
+import net.minecraft.client.gui.hud.PlayerListHud;
+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.floodhunt.client.FloodhuntClient;
+
+@Mixin(PlayerListHud.class)
+public class NoPlayerListHud {
+ @Inject(at = @At("HEAD"), method = "render", cancellable = true)
+ public void render(CallbackInfo ci) {
+ if (FloodhuntClient.showTab() || !FloodhuntClient.gameStarted()) return;
+ ci.cancel();
+ }
+}
diff --git a/src/client/java/world/anhgelus/floodhunt/client/mixin/NoSkin.java b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoSkin.java
new file mode 100644
index 0000000..22d2337
--- /dev/null
+++ b/src/client/java/world/anhgelus/floodhunt/client/mixin/NoSkin.java
@@ -0,0 +1,27 @@
+package world.anhgelus.floodhunt.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 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;
+import world.anhgelus.floodhunt.Floodhunt;
+import world.anhgelus.floodhunt.client.FloodhuntClient;
+
+@Mixin(AbstractClientPlayerEntity.class)
+public class NoSkin {
+ @Inject(at = @At("HEAD"), method = "getSkin", cancellable = true)
+ public void getSkin(CallbackInfoReturnable<SkinTextures> cir) {
+ if (FloodhuntClient.showSkins() || !FloodhuntClient.gameStarted()) return;
+ cir.setReturnValue(SkinTextures.create(
+ new AssetInfo.TextureAssetInfo(Identifier.of(Floodhunt.MOD_ID, "skin")),
+ null,
+ null,
+ PlayerSkinType.WIDE
+ ));
+ }
+}