Skip to content

Commit 42b9af5

Browse files
fix: update fluid velocity mixin target to EntityFluidInteraction#update
From what I see the logic for handling flow push has been moved here.
1 parent 4fed537 commit 42b9af5

File tree

3 files changed

+38
-13
lines changed

3 files changed

+38
-13
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3+
* Copyright (c) Meteor Development.
4+
*/
5+
6+
package meteordevelopment.meteorclient.mixin;
7+
8+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
9+
import meteordevelopment.meteorclient.systems.modules.Modules;
10+
import meteordevelopment.meteorclient.systems.modules.movement.Velocity;
11+
import net.minecraft.world.entity.Entity;
12+
import net.minecraft.world.entity.EntityFluidInteraction;
13+
import net.minecraft.world.phys.Vec3;
14+
import org.spongepowered.asm.mixin.Mixin;
15+
import org.spongepowered.asm.mixin.injection.At;
16+
17+
import static meteordevelopment.meteorclient.MeteorClient.mc;
18+
19+
@Mixin(EntityFluidInteraction.class)
20+
public abstract class EntityFluidInteractionMixin {
21+
@ModifyExpressionValue(
22+
method = "update",
23+
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;getFlow(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/Vec3;")
24+
)
25+
private Vec3 modifyFluidFlow(Vec3 flow, final Entity entity, final boolean ignoreCurrent) {
26+
if (entity != mc.player) return flow;
27+
28+
Velocity velocity = Modules.get().get(Velocity.class);
29+
if (velocity.isActive() && velocity.liquids.get()) {
30+
double h = velocity.getHorizontal(velocity.liquidsHorizontal);
31+
double v = velocity.getVertical(velocity.liquidsVertical);
32+
flow = flow.multiply(h, v, h);
33+
}
34+
35+
return flow;
36+
}
37+
}

src/main/java/meteordevelopment/meteorclient/mixin/EntityMixin.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,6 @@
4343

4444
@Mixin(Entity.class)
4545
public abstract class EntityMixin {
46-
@ModifyExpressionValue(method = "updateFluidHeightAndDoFluidPushing", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;getFlow(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/Vec3;"))
47-
private Vec3 updateFluidHeightAndDoFluidPushingFluidStateGetVelocity(Vec3 vec) {
48-
if ((Object) this != mc.player) return vec;
49-
50-
Velocity velocity = Modules.get().get(Velocity.class);
51-
if (velocity.isActive() && velocity.liquids.get()) {
52-
vec = vec.multiply(velocity.getHorizontal(velocity.liquidsHorizontal), velocity.getVertical(velocity.liquidsVertical), velocity.getHorizontal(velocity.liquidsHorizontal));
53-
}
54-
55-
return vec;
56-
}
57-
5846
@Inject(method = "isInWater", at = @At(value = "HEAD"), cancellable = true)
5947
private void isInWater(CallbackInfoReturnable<Boolean> cir) {
6048
if ((Object) this != mc.player) return;

src/main/java/meteordevelopment/meteorclient/utils/entity/simulator/ProjectileEntitySimulator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ else if (simulatingEntity instanceof Projectile) {
313313
}
314314

315315
/**
316-
* {@link net.minecraft.world.entity.Entity#updateFluidHeightAndDoFluidPushing(TagKey, double)}
316+
* {@link net.minecraft.world.entity.EntityFluidInteraction#update(Entity, boolean)}
317317
*/
318318
public void tickIsTouchingWater() {
319319
AABB box = dimensions.makeBoundingBox(pos.x, pos.y, pos.z).deflate(0.001);

0 commit comments

Comments
 (0)