ForceProviderStandard.java
package com.hypixel.hytale.server.core.modules.physics.util;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.math.vector.Vector3d;
import javax.annotation.Nonnull;
public abstract class ForceProviderStandard implements ForceProvider {
@Nonnull
public static HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
@Nonnull
protected Vector3d dragForce = new Vector3d();
public ForceProviderStandard() {
}
public abstract double getMass(double var1);
public abstract double getVolume();
public abstract double getDensity();
public ;
;
ForceProviderStandardState ;
{
.getForceProviderStandardState();
standardState.externalForce;
extForce.y;
accumulator.force.add(extForce);
accumulator.speed;
standardState.dragCoefficient * .getProjectedArea(bodyState, speed) * speed;
.dragForce.assign(bodyState.velocity).scale(-dragForceDivSpeed);
.clipForce(.dragForce, accumulator.resistanceForceLimit);
accumulator.force.add(.dragForce);
-standardState.gravity * .getMass(.getVolume());
(onGround) {
(gravityForce + extForceY) * .getFrictionCoefficient();
(speed > && frictionForce > ) {
frictionForce /= speed;
accumulator.force;
var10000.x -= bodyState.velocity.x * frictionForce;
var10000 = accumulator.force;
var10000.z -= bodyState.velocity.z * frictionForce;
}
} {
accumulator.force;
var18.y += gravityForce;
}
(standardState.displacedMass != ) {
accumulator.force;
var19.y += standardState.displacedMass * standardState.gravity;
}
}
{
(threshold.x < ) {
(value.x < threshold.x) {
value.x = threshold.x;
}
} (value.x > threshold.x) {
value.x = threshold.x;
}
(threshold.y < ) {
(value.y < threshold.y) {
value.y = threshold.y;
}
} (value.y > threshold.y) {
value.y = threshold.y;
}
(threshold.z < ) {
(value.z < threshold.z) {
value.z = threshold.z;
}
} (value.z > threshold.z) {
value.z = threshold.z;
}
}
}