aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob <55346310+Kathund@users.noreply.github.com>2025-08-12 04:58:14 +0800
committerGitHub <noreply@github.com>2025-08-11 22:58:14 +0200
commit3fe5ec7233fcfaa6884c7676fd720f3a3600cd58 (patch)
tree28cc36f0ebcbf121f0f63c2bb746d1ace1358f0a
parent773a8bec96877d0210044b335a83ac12a460cad5 (diff)
downloadFirmament-3fe5ec7233fcfaa6884c7676fd720f3a3600cd58.tar.gz
Firmament-3fe5ec7233fcfaa6884c7676fd720f3a3600cd58.tar.bz2
Firmament-3fe5ec7233fcfaa6884c7676fd720f3a3600cd58.zip
feat: remove offhand (#125)
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java31
-rw-r--r--src/main/kotlin/features/fixes/Fixes.kt1
-rw-r--r--translations/en_us.json2
3 files changed, 34 insertions, 0 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java
new file mode 100644
index 0000000..12455f4
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java
@@ -0,0 +1,31 @@
+package moe.nea.firmament.mixins;
+
+import moe.nea.firmament.features.fixes.Fixes;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.screen.PlayerScreenHandler;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.Unique;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(PlayerScreenHandler.class)
+public class MixinPlayerScreenHandler {
+
+ @Unique
+ private static final int OFF_HAND_SLOT = 40;
+
+ @Inject(method = "<init>", at = @At("TAIL"))
+ private void moveOffHandSlot(PlayerInventory inventory, boolean onServer, PlayerEntity owner, CallbackInfo ci) {
+ if (Fixes.TConfig.INSTANCE.getHideOffHand()) {
+ PlayerScreenHandler self = (PlayerScreenHandler) (Object) this;
+ self.slots.stream()
+ .filter(slot -> slot.getIndex() == OFF_HAND_SLOT)
+ .forEach(slot -> {
+ slot.x = -1000;
+ slot.y = -1000;
+ });
+ }
+ }
+}
diff --git a/src/main/kotlin/features/fixes/Fixes.kt b/src/main/kotlin/features/fixes/Fixes.kt
index d490cc4..0105624 100644
--- a/src/main/kotlin/features/fixes/Fixes.kt
+++ b/src/main/kotlin/features/fixes/Fixes.kt
@@ -29,6 +29,7 @@ object Fixes : FirmamentFeature {
val noHurtCam by toggle("disable-hurt-cam") { false }
val hideSlotHighlights by toggle("hide-slot-highlights") { false }
val hideRecipeBook by toggle("hide-recipe-book") { false }
+ val hideOffHand by toggle("hide-off-hand") { false }
}
override val config: ManagedConfig
diff --git a/translations/en_us.json b/translations/en_us.json
index 12fc57d..542abe0 100644
--- a/translations/en_us.json
+++ b/translations/en_us.json
@@ -160,6 +160,8 @@
"firmament.config.fixes.disable-hurt-cam.description": "Disable the damage screen shake animation.",
"firmament.config.fixes.hide-mob-effects": "Hide Potion Effects",
"firmament.config.fixes.hide-mob-effects.description": "Hide Potion effects on the right side of your player inventory.",
+ "firmament.config.fixes.hide-off-hand": "No Off Hand",
+ "firmament.config.fixes.hide-off-hand.description": "Remove the recipe slot from your inventory",
"firmament.config.fixes.hide-potion-effects-hud": "Hide Potion Effects HUD",
"firmament.config.fixes.hide-potion-effects-hud.description": "Hides the potion effects HUD in the top right.",
"firmament.config.fixes.hide-recipe-book": "No Recipe Book",