Record Class BattleSceneBlockData
java.lang.Object
java.lang.Record
com.pixelmonmod.pixelmon.api.battles.scene.BattleSceneBlockData
- Record Components:
pos- the structure-relative or client-ready block positionstate- the block state to render in the scenenbt- copied block entity data, ornullwhen the block has none
public record BattleSceneBlockData(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.nbt.CompoundTag nbt)
extends Record
Serializable block snapshot for a battle scene.
These are extracted from a server-side structure and sent to the client so the scene can be rendered without the client needing direct access to the server's structure manager.
-
Constructor Summary
ConstructorsConstructorDescriptionBattleSceneBlockData(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.nbt.CompoundTag nbt) Creates a block snapshot and defensively copies the supplied block entity data.BattleSceneBlockData(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfo) Creates a serializable block snapshot from a structure template block. -
Method Summary
Modifier and TypeMethodDescriptionstatic BattleSceneBlockDatadecode(net.minecraft.network.FriendlyByteBuf buffer) Decodes a scene block snapshot from the network.voidencode(net.minecraft.network.FriendlyByteBuf buffer) Encodes this scene block snapshot for the client.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.@Nullable net.minecraft.nbt.CompoundTagnbt()Returns the value of thenbtrecord component.offset(net.minecraft.core.BlockPos offset) Returns a copy of this block shifted by the supplied offset.net.minecraft.core.BlockPospos()Returns the value of theposrecord component.net.minecraft.world.level.block.state.BlockStatestate()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
BattleSceneBlockData
public BattleSceneBlockData(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.nbt.CompoundTag nbt) Creates a block snapshot and defensively copies the supplied block entity data.- Parameters:
pos- the block positionstate- the block statenbt- block entity data to copy, ornull
-
BattleSceneBlockData
public BattleSceneBlockData(net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.StructureBlockInfo blockInfo) Creates a serializable block snapshot from a structure template block.- Parameters:
blockInfo- the structure block information to copy
-
-
Method Details
-
offset
Returns a copy of this block shifted by the supplied offset.- Parameters:
offset- the block position offset to apply- Returns:
- the shifted block data
-
decode
Decodes a scene block snapshot from the network.- Parameters:
buffer- the packet buffer to read from- Returns:
- the decoded block data
-
encode
public void encode(net.minecraft.network.FriendlyByteBuf buffer) Encodes this scene block snapshot for the client.- Parameters:
buffer- the packet buffer to write to
-
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). -
pos
public net.minecraft.core.BlockPos pos()Returns the value of theposrecord component.- Returns:
- the value of the
posrecord component
-
state
public net.minecraft.world.level.block.state.BlockState state()Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
nbt
@Nullable public @Nullable net.minecraft.nbt.CompoundTag nbt()Returns the value of thenbtrecord component.- Returns:
- the value of the
nbtrecord component
-