From f6acb9b9a56d5da2885575316c231ecbaa80f717 Mon Sep 17 00:00:00 2001 From: lowercasebtw <126462578+lowercasebtw@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:26:04 -0400 Subject: [PATCH] Add setting for item tilt in <= 1.7 (#579) --- .../mixin/fixes/minecraft/item/MixinHeldItemRenderer.java | 4 +--- .../viafabricplus/settings/impl/VisualSettings.java | 1 + src/main/resources/assets/viafabricplus/lang/en_us.json | 1 + 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java index 6b1de9ba..580dfd81 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/item/MixinHeldItemRenderer.java @@ -19,8 +19,6 @@ package de.florianmichael.viafabricplus.injection.mixin.fixes.minecraft.item; -import com.viaversion.viaversion.api.protocol.version.ProtocolVersion; -import de.florianmichael.viafabricplus.protocoltranslator.ProtocolTranslator; import de.florianmichael.viafabricplus.settings.impl.VisualSettings; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.VertexConsumerProvider; @@ -81,7 +79,7 @@ public abstract class MixinHeldItemRenderer { at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/HeldItemRenderer;renderItem(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", ordinal = 1)) private void transformItemPosition1_7(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack stack, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { // Modifies the handheld position to be slightly tilted like in 1.7 and prior - if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_7_6) && !(stack.getItem() instanceof BlockItem)) { + if (VisualSettings.global().tiltItemPositions.isEnabled() && !(stack.getItem() instanceof BlockItem)) { final Arm arm = hand == Hand.MAIN_HAND ? player.getMainArm() : player.getMainArm().getOpposite(); final int direction = arm == Arm.RIGHT ? 1 : -1; diff --git a/src/main/java/de/florianmichael/viafabricplus/settings/impl/VisualSettings.java b/src/main/java/de/florianmichael/viafabricplus/settings/impl/VisualSettings.java index 7b764197..3f50b9e6 100644 --- a/src/main/java/de/florianmichael/viafabricplus/settings/impl/VisualSettings.java +++ b/src/main/java/de/florianmichael/viafabricplus/settings/impl/VisualSettings.java @@ -81,6 +81,7 @@ public class VisualSettings extends SettingGroup { // 1.8.x -> 1.7.6 - 1.7.10 public final VersionedBooleanSetting swingHandOnItemUse = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.swing_hand_on_item_use"), VersionRange.andOlder(ProtocolVersion.v1_7_6)); + public final VersionedBooleanSetting tiltItemPositions = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.tilt_item_positions"), VersionRange.andOlder(ProtocolVersion.v1_7_6)); public final VersionedBooleanSetting enableLegacyTablist = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.enable_legacy_tablist"), VersionRange.andOlder(ProtocolVersion.v1_7_6)); // 1.0.0-1.0.1 -> b1.8-b1.8.1 diff --git a/src/main/resources/assets/viafabricplus/lang/en_us.json b/src/main/resources/assets/viafabricplus/lang/en_us.json index e4035a9a..5dae3cf3 100644 --- a/src/main/resources/assets/viafabricplus/lang/en_us.json +++ b/src/main/resources/assets/viafabricplus/lang/en_us.json @@ -100,6 +100,7 @@ "visual_settings.viafabricplus.disable_server_pinging": "Disable server pinging", "visual_settings.viafabricplus.sideways_backwards_walking": "Sideways backwards walking", "visual_settings.viafabricplus.enable_legacy_tablist": "Enable legacy tablist", + "visual_settings.viafabricplus.tilt_item_positions": "Tilt item positions", "visual_settings.viafabricplus.hide_furnace_recipe_book": "Hide furnace recipe book", "visual_settings.viafabricplus.hide_crafting_recipe_book": "Hide crafting recipe book", "visual_settings.viafabricplus.hide_modern_jigsaw_screen_features": "Hide modern Jigsaw screen features",