Record Class BlockStatePalette
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.block.BlockStatePalette
- All Implemented Interfaces:
CustomRegistryOwnTypeProvider<io.netty.buffer.ByteBuf, BlockStatePalette>, CustomRegistryValue<io.netty.buffer.ByteBuf, BlockStatePalette>, RefOptimizer<BlockStatePalette>, WithKey, WithRef<BlockStatePalette>
public record BlockStatePalette(@Nullable UnitType<io.netty.buffer.ByteBuf, BlockStatePalette> typeOverride, it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map, @Nullable net.minecraft.world.level.block.state.BlockState singleState, int totalWeight)
extends Record
implements CustomRegistryValue<io.netty.buffer.ByteBuf, BlockStatePalette>
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Ref<BlockStatePalette>> static final DataType<Ref<BlockStatePalette>> static final UnitType<io.netty.buffer.ByteBuf, BlockStatePalette> static final CustomRegistry<io.netty.buffer.ByteBuf, BlockStatePalette> static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Ref<BlockStatePalette>> static final DynamicType<io.netty.buffer.ByteBuf, BlockStatePalette> Fields inherited from interface WithKey
COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionBlockStatePalette(@Nullable UnitType<io.netty.buffer.ByteBuf, BlockStatePalette> typeOverride, it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map, @Nullable net.minecraft.world.level.block.state.BlockState singleState, int totalWeight) Creates an instance of aBlockStatePaletterecord class.BlockStatePalette(it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map) BlockStatePalette(net.minecraft.world.level.block.state.BlockState state) -
Method Summary
Modifier and TypeMethodDescriptionstatic BlockStatePalette.Builderbuilder()static voidbuiltInTypes(CustomRegistryTypeCollector<io.netty.buffer.ByteBuf, BlockStatePalette> collector) final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.level.block.state.BlockStateget(int at) CustomRegistry<io.netty.buffer.ByteBuf, BlockStatePalette> final inthashCode()Returns a hash code value for this object.it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map()Returns the value of themaprecord component.net.minecraft.world.level.block.state.BlockStatesample(net.minecraft.util.RandomSource random) @Nullable net.minecraft.world.level.block.state.BlockStateReturns the value of thesingleStaterecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of thetotalWeightrecord component.CustomRegistryType<io.netty.buffer.ByteBuf, BlockStatePalette> type()@Nullable UnitType<io.netty.buffer.ByteBuf, BlockStatePalette> Returns the value of thetypeOverriderecord component.Methods inherited from interface CustomRegistryValue
optionalKey, refMethods inherited from interface RefOptimizer
optimize
-
Field Details
-
TYPE
-
EMPTY
-
REGISTRY
-
CODEC
-
STREAM_CODEC
public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Ref<BlockStatePalette>> STREAM_CODEC -
DATA_TYPE
-
-
Constructor Details
-
BlockStatePalette
public BlockStatePalette(it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map) -
BlockStatePalette
public BlockStatePalette(net.minecraft.world.level.block.state.BlockState state) -
BlockStatePalette
public BlockStatePalette(@Nullable @Nullable UnitType<io.netty.buffer.ByteBuf, BlockStatePalette> typeOverride, it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map, @Nullable @Nullable net.minecraft.world.level.block.state.BlockState singleState, int totalWeight) Creates an instance of aBlockStatePaletterecord class.- Parameters:
typeOverride- the value for thetypeOverriderecord componentmap- the value for themaprecord componentsingleState- the value for thesingleStaterecord componenttotalWeight- the value for thetotalWeightrecord component
-
-
Method Details
-
builder
-
builtInTypes
public static void builtInTypes(CustomRegistryTypeCollector<io.netty.buffer.ByteBuf, BlockStatePalette> collector) -
getRegistry
- Specified by:
getRegistryin interfaceCustomRegistryValue<io.netty.buffer.ByteBuf, BlockStatePalette>
-
type
- Specified by:
typein interfaceCustomRegistryOwnTypeProvider<io.netty.buffer.ByteBuf, BlockStatePalette>
-
get
public net.minecraft.world.level.block.state.BlockState get(int at) -
sample
public net.minecraft.world.level.block.state.BlockState sample(net.minecraft.util.RandomSource random) -
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
typeOverride
Returns the value of thetypeOverriderecord component.- Returns:
- the value of the
typeOverriderecord component
-
map
public it.unimi.dsi.fastutil.objects.Reference2IntMap<net.minecraft.world.level.block.state.BlockState> map()Returns the value of themaprecord component.- Returns:
- the value of the
maprecord component
-
singleState
@Nullable public @Nullable net.minecraft.world.level.block.state.BlockState singleState()Returns the value of thesingleStaterecord component.- Returns:
- the value of the
singleStaterecord component
-
totalWeight
public int totalWeight()Returns the value of thetotalWeightrecord component.- Returns:
- the value of the
totalWeightrecord component
-