Add setting for item tilt in <= 1.7 (#579)

This commit is contained in:
lowercasebtw 2024-10-11 12:26:04 -04:00 committed by GitHub
parent 12bafd99f5
commit f6acb9b9a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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

View File

@ -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",