Record Class DispatchableFunction<T>
java.lang.Object
java.lang.Record
com.lightning.northstar.planet.data.func.DispatchableFunction<T>
- All Implemented Interfaces:
LevelFunction
@ParametersAreNonnullByDefault
public record DispatchableFunction<T>(net.minecraft.resources.ResourceLocation type, BiFunction<net.minecraft.world.level.Level,net.minecraft.core.BlockPos,T> key, Map<T,LevelFunction> entries, LevelFunction fallback)
extends Record
implements LevelFunction
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DispatchableFunction.Factory<net.minecraft.resources.ResourceLocation> static final DispatchableFunction.Factory<net.minecraft.world.level.block.Block> static final net.minecraft.resources.ResourceLocationThe key used to mark fallback entries.static final com.mojang.serialization.Codec<net.minecraft.resources.ResourceLocation> A codec that only acceptsFALLBACK_KEYor fails.static final DispatchableFunction.Factory<net.minecraft.resources.ResourceLocation> Fields inherited from interface com.lightning.northstar.planet.data.func.LevelFunction
CODEC, CODEC_NO_INLINE, REGISTRY -
Constructor Summary
ConstructorsConstructorDescriptionDispatchableFunction(net.minecraft.resources.ResourceLocation type, BiFunction<net.minecraft.world.level.Level, net.minecraft.core.BlockPos, T> key, Map<T, LevelFunction> entries, LevelFunction fallback) Creates an instance of aDispatchableFunctionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> com.mojang.serialization.MapCodec<DispatchableFunction<T>> codec(com.mojang.serialization.Codec<T> codec, Function<it.unimi.dsi.fastutil.Pair<LevelFunction, Map<T, LevelFunction>>, DispatchableFunction<T>> constructor) entries()Returns the value of theentriesrecord component.final booleanIndicates whether some other object is "equal to" this one.fallback()Returns the value of thefallbackrecord component.floatget(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) final inthashCode()Returns a hash code value for this object.BiFunction<net.minecraft.world.level.Level, net.minecraft.core.BlockPos, T> key()Returns the value of thekeyrecord component.final StringtoString()Returns a string representation of this record class.net.minecraft.resources.ResourceLocationtype()Returns the value of thetyperecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.lightning.northstar.planet.data.func.LevelFunction
add, div, mul, sub
-
Field Details
-
FALLBACK_KEY
public static final net.minecraft.resources.ResourceLocation FALLBACK_KEYThe key used to mark fallback entries. -
FALLBACK_KEY_CODEC
public static final com.mojang.serialization.Codec<net.minecraft.resources.ResourceLocation> FALLBACK_KEY_CODECA codec that only acceptsFALLBACK_KEYor fails. -
BIOME
-
BLOCK
-
WEATHER
-
-
Constructor Details
-
DispatchableFunction
public DispatchableFunction(net.minecraft.resources.ResourceLocation type, BiFunction<net.minecraft.world.level.Level, net.minecraft.core.BlockPos, T> key, Map<T, LevelFunction> entries, LevelFunction fallback) Creates an instance of aDispatchableFunctionrecord class.- Parameters:
type- the value for thetyperecord componentkey- the value for thekeyrecord componententries- the value for theentriesrecord componentfallback- the value for thefallbackrecord component
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.MapCodec<DispatchableFunction<T>> codec(com.mojang.serialization.Codec<T> codec, Function<it.unimi.dsi.fastutil.Pair<LevelFunction, Map<T, LevelFunction>>, DispatchableFunction<T>> constructor) -
get
public float get(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) - Specified by:
getin interfaceLevelFunction
-
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). -
type
public net.minecraft.resources.ResourceLocation type()Returns the value of thetyperecord component.- Specified by:
typein interfaceLevelFunction- Returns:
- the value of the
typerecord component
-
key
Returns the value of thekeyrecord component.- Returns:
- the value of the
keyrecord component
-
entries
Returns the value of theentriesrecord component.- Returns:
- the value of the
entriesrecord component
-
fallback
Returns the value of thefallbackrecord component.- Returns:
- the value of the
fallbackrecord component
-