Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swim speed applies only to vertical movement when in lava #1852

Open
ChiefArug opened this issue Jan 14, 2025 · 0 comments
Open

Swim speed applies only to vertical movement when in lava #1852

ChiefArug opened this issue Jan 14, 2025 · 0 comments
Labels
triage Needs triaging and confirmation

Comments

@ChiefArug
Copy link
Contributor

ChiefArug commented Jan 14, 2025

Minecraft Version: 1.21.1

NeoForge Version: 21.1.92

Steps to Reproduce:

  1. /attribute @s neoforge:swim_speed base set 100
  2. Swim in water. Note you are very fast no matter what direction you go in
  3. Swim in lava. Note you are very fast only when going up.

Description of issue:
Swim speed applies only to vertical movement in lava.

Code analysis:
This appears to be because in the LivingEntity patch the fluid is checked to be water before applying bonus sideways velocity:

+ if (this.isInWater() || (this.isInFluidType(fluidState) && !this.moveInFluid(fluidState, p_365480_, d1))) {
float f = this.isSprinting() ? 0.9F : this.getWaterSlowDown();
float f1 = 0.02F;
float f2 = (float)this.getAttributeValue(Attributes.WATER_MOVEMENT_EFFICIENCY);
@@ -2249,6 +_,7 @@
f = 0.96F;
}
+ f1 *= (float)this.getAttributeValue(net.neoforged.neoforge.common.NeoForgeMod.SWIM_SPEED);

However the jumpInFluid method that is called for vertical movement does not check fluid type before applying bonus momentum:
default void jumpInFluid(FluidType type) {
self().setDeltaMovement(self().getDeltaMovement().add(0.0D, (double) 0.04F * self().getAttributeValue(NeoForgeMod.SWIM_SPEED), 0.0D));
}

Suggested Solution:
In the jumpInFluid method check the fluid type is water before applying bonus momentum.

@ChiefArug ChiefArug added the triage Needs triaging and confirmation label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triaging and confirmation
Projects
None yet
Development

No branches or pull requests

1 participant