Record Class InterpolatedGravityFunction
java.lang.Object
java.lang.Record
net.frozenblock.lib.gravity.api.functions.InterpolatedGravityFunction
- All Implemented Interfaces:
GravityFunction,SerializableGravityFunction<InterpolatedGravityFunction>
public record InterpolatedGravityFunction(net.minecraft.world.phys.Vec3 gravity)
extends Record
implements SerializableGravityFunction<InterpolatedGravityFunction>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<GravityBelt<InterpolatedGravityFunction>>static final com.mojang.serialization.Codec<InterpolatedGravityFunction> -
Constructor Summary
ConstructorsConstructorDescriptionInterpolatedGravityFunction(net.minecraft.world.phys.Vec3 gravity) Creates an instance of aInterpolatedGravityFunctionrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.Codec<InterpolatedGravityFunction>codec()final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.phys.Vec3get(@Nullable net.minecraft.world.entity.Entity entity, double y, double minY, double maxY) net.minecraft.world.phys.Vec3gravity()Returns the value of thegravityrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
-
BELT_CODEC
public static final com.mojang.serialization.Codec<GravityBelt<InterpolatedGravityFunction>> BELT_CODEC
-
-
Constructor Details
-
InterpolatedGravityFunction
public InterpolatedGravityFunction(net.minecraft.world.phys.Vec3 gravity) Creates an instance of aInterpolatedGravityFunctionrecord class.- Parameters:
gravity- the value for thegravityrecord component
-
-
Method Details
-
get
public net.minecraft.world.phys.Vec3 get(@Nullable @Nullable net.minecraft.world.entity.Entity entity, double y, double minY, double maxY) - Specified by:
getin interfaceGravityFunction- Parameters:
entity- The optional entity being trackedy- The current y positionminY- The minimum Y position of the gravity beltmaxY- The maximum Y position of the gravity belt- Returns:
- The gravity value
-
codec
- Specified by:
codecin interfaceSerializableGravityFunction<InterpolatedGravityFunction>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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 withObjects::equals(Object,Object). -
gravity
public net.minecraft.world.phys.Vec3 gravity()Returns the value of thegravityrecord component.- Returns:
- the value of the
gravityrecord component
-