Record Class Viscosity
java.lang.Object
java.lang.Record
fr.robie.machineengine.api.resource.fluid.Viscosity
- Record Components:
speed- walking and swimming speed multiplier (movement_speed), above 0gravity- gravity multiplier (1.20.5+), 0 or morejump- jump strength multiplier (1.20.5+), 0 or moreswim- addedwater_movement_efficiency(1.21+), 0 to 1: above 0 swims faster than waterdamping- player velocity lost every 2 ticks inside, 0 to 0.9 (thick fluids)entityDrag- velocity other entities lose every 2 ticks inside, 0 to 0.9
public record Viscosity(double speed, double gravity, double jump, double swim, double damping, double entityDrag)
extends Record
How a fluid moves things inside it, compared with water (all factors 1 and no damping = water).
Players are moved by their client, so their speed, gravity and jump are attribute modifiers the
client predicts (smooth). Water's swimming acceleration can only be raised that way (swim),
never lowered: fluids thicker than water use damping, which the server applies to the
player's velocity (it can stutter a little). Other entities (mobs, items, boats) are moved by the
server, so entityDrag is smooth for them.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionViscosity(double speed, double gravity, double jump, double swim, double damping, double entityDrag) Creates an instance of aViscosityrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubledamping()Returns the value of thedampingrecord component.doubleReturns the value of theentityDragrecord component.final booleanIndicates whether some other object is "equal to" this one.doublegravity()Returns the value of thegravityrecord component.final inthashCode()Returns a hash code value for this object.booleanisWater()Whether this changes nothing compared with water.doublejump()Returns the value of thejumprecord component.doublespeed()Returns the value of thespeedrecord component.doubleswim()Returns the value of theswimrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
WATER
Water: changes nothing.
-
-
Constructor Details
-
Viscosity
public Viscosity(double speed, double gravity, double jump, double swim, double damping, double entityDrag) Creates an instance of aViscosityrecord class.- Parameters:
speed- the value for thespeedrecord componentgravity- the value for thegravityrecord componentjump- the value for thejumprecord componentswim- the value for theswimrecord componentdamping- the value for thedampingrecord componententityDrag- the value for theentityDragrecord component
-
-
Method Details
-
isWater
public boolean isWater()Whether this changes nothing compared with water. -
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
speed
-
gravity
-
jump
-
swim
-
damping
-
entityDrag
public double entityDrag()Returns the value of theentityDragrecord component.- Returns:
- the value of the
entityDragrecord component
-