Skip to content

Commit 2329f12

Browse files
author
micheal65536
committed
simplify rowing calculation and tweak parameters
1 parent 27e39be commit 2329f12

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

  • common/src/main/java/org/vivecraft/client_vr/gameplay/trackers

common/src/main/java/org/vivecraft/client_vr/gameplay/trackers/RowTracker.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import net.minecraft.client.Minecraft;
44
import net.minecraft.client.player.LocalPlayer;
5-
import net.minecraft.core.BlockPos;
65
import net.minecraft.util.Mth;
76
import net.minecraft.world.entity.vehicle.Boat;
87
import net.minecraft.world.phys.Vec3;
@@ -13,7 +12,7 @@
1312
import org.vivecraft.common.utils.MathUtils;
1413

1514
public class RowTracker extends Tracker {
16-
private static final double TRANSMISSION_EFFICIENCY = 0.9D;
15+
private static final double TRANSMISSION_EFFICIENCY = 1.0D;
1716

1817
public double[] forces = new double[]{0.0D, 0.0D};
1918
private final Vec3[] lastUWPs = new Vec3[2];
@@ -74,15 +73,11 @@ public void doProcess(LocalPlayer player) {
7473
inWater = true;
7574

7675
Vec3 attach = this.getAttachmentPoint(paddle, boat);
77-
Vec3 underWaterPoint = attach.add(arm2Pad.normalize()).subtract(boat.position());
76+
Vec3 underWaterPoint = attach.add(arm2Pad.normalize());
7877

7978
if (this.lastUWPs[paddle] != null) {
8079
Vector3f forceVector = MathUtils.subtractToVector3f(this.lastUWPs[paddle],
8180
underWaterPoint); // intentionally reverse
82-
forceVector = forceVector.sub(
83-
(float) boat.getDeltaMovement().x,
84-
(float) boat.getDeltaMovement().y,
85-
(float) boat.getDeltaMovement().z);
8681

8782
Vector3f forward = boatRot.transform(MathUtils.FORWARD, new Vector3f());
8883

@@ -149,7 +144,7 @@ private Vec3 getAbsArmPos(int side) {
149144
private boolean isPaddleUnderWater(int paddle, Boat boat) {
150145
Vec3 attachAbs = this.getAttachmentPoint(paddle, boat);
151146
Vec3 armToPaddle = this.getArmToPaddleVector(paddle, boat).normalize();
152-
BlockPos blockPos = new BlockPos(attachAbs.add(armToPaddle));
153-
return boat.level.getBlockState(blockPos).getMaterial().isLiquid();
147+
Vec3 blockPos = attachAbs.add(armToPaddle);
148+
return blockPos.subtract(boat.position()).y < 0.2F;
154149
}
155150
}

0 commit comments

Comments
 (0)