Skip to content

Commit

Permalink
Add setting for body rotation interpolation fix
Browse files Browse the repository at this point in the history
Some mods changing the player rotation will break with this fix since they hook into the getYaw() call of the original function which we don't account for.
  • Loading branch information
FlorianMichael committed Oct 22, 2024
1 parent bf7bc8f commit 2cb50a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private boolean allowPlayerToBeMovedByEntityPackets(LivingEntity instance) {

@Redirect(method = "turnHead", at = @At(value = "INVOKE", target = "Ljava/lang/Math;abs(F)F"))
private float changeBodyRotationInterpolation(float g) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3)) {
if (VisualSettings.global().changeBodyRotationInterpolation.isEnabled()) {
g = MathHelper.clamp(g, -75.0F, 75.0F);
this.bodyYaw = this.getYaw() - g;
if (Math.abs(g) > 50.0F) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ public void onValueChanged() {
// 1.21 -> 1.20.5
public final VersionedBooleanSetting hideDownloadTerrainScreenTransitionEffects = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.hide_download_terrain_screen_transition_effects"), VersionRange.andOlder(ProtocolVersion.v1_20_5));

// 1.19.4 -> 1.19.3
public final VersionedBooleanSetting changeBodyRotationInterpolation = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.change_body_rotation_interpolation"), VersionRange.andOlder(ProtocolVersion.v1_19_3));

// 1.19.2 -> 1.19
public final VersionedBooleanSetting disableSecureChatWarning = new VersionedBooleanSetting(this, Text.translatable("visual_settings.viafabricplus.disable_secure_chat_warning"), VersionRange.andOlder(ProtocolVersion.v1_19));

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/viafabricplus/lang/de_de.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Unicode-Schriftart für Nicht-ASCII-Sprachen erzwingen",
"visual_settings.viafabricplus.filter_non_existing_glyphs": "Nicht vorhandene Glyphen filtern",
"visual_settings.viafabricplus.sneak_instantly": "Sofort schleichen",
"visual_settings.viafabricplus.change_body_rotation_interpolation": "Interpolation der Körperdrehung ändern",

"force_version.viafabricplus.title": "Bitte wähle die Version, mit der der Server gepingt/verbunden werden soll",

Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/viafabricplus/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"visual_settings.viafabricplus.force_unicode_font_for_non_ascii_languages": "Force Unicode font for non-ASCII languages",
"visual_settings.viafabricplus.filter_non_existing_glyphs": "Filter non existing glyphs",
"visual_settings.viafabricplus.sneak_instantly": "Sneak instantly",
"visual_settings.viafabricplus.change_body_rotation_interpolation": "Change body rotation interpolation",

"force_version.viafabricplus.title": "Please select the version with which the server should be pinged/connected",

Expand Down

0 comments on commit 2cb50a1

Please sign in to comment.