Record Class SimpleKNumber
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.knumber.SimpleKNumber
- All Implemented Interfaces:
KNumber, CustomRegistryOwnTypeProvider<net.minecraft.network.RegistryFriendlyByteBuf, KNumber>, CustomRegistryValue<net.minecraft.network.RegistryFriendlyByteBuf, KNumber>, RefOptimizer<KNumber>, WithKey, WithRef<KNumber>
-
Field Summary
Fields inherited from interface KNumber
CLOCK, CODEC, DATA_TYPE, ERROR_NOT_A_NUMBER, GAME_DAY, GAME_TIME, MAX_TICK, ONE, PREFIX_LIST, PROGRESS, REGISTRY, STREAM_CODEC, TICK, ZEROFields inherited from interface WithKey
COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionSimpleKNumber(UnitType<net.minecraft.network.RegistryFriendlyByteBuf, KNumber> type, Function<KNumberContext, Double> factory) Creates an instance of aSimpleKNumberrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.factory()Returns the value of thefactoryrecord component.@Nullable Doubleget(KNumberContext ctx) final inthashCode()Returns a hash code value for this object.@NonNull StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.Methods inherited from interface CustomRegistryValue
optionalKey, refMethods inherited from interface KNumber
getOr, getOrNaN, getRegistry, isStringLiteral, offset, scaleMethods inherited from interface RefOptimizer
optimize
-
Constructor Details
-
SimpleKNumber
public SimpleKNumber(UnitType<net.minecraft.network.RegistryFriendlyByteBuf, KNumber> type, Function<KNumberContext, Double> factory) Creates an instance of aSimpleKNumberrecord class.- Parameters:
type- the value for thetyperecord componentfactory- the value for thefactoryrecord component
-
-
Method Details
-
get
-
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 withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Specified by:
typein interfaceCustomRegistryOwnTypeProvider<net.minecraft.network.RegistryFriendlyByteBuf, KNumber>- Returns:
- the value of the
typerecord component
-
factory
Returns the value of thefactoryrecord component.- Returns:
- the value of the
factoryrecord component
-