Record Class BlockReference
java.lang.Object
java.lang.Record
dan200.computercraft.api.detail.BlockReference
- Record Components:
level- The level the block exists in.pos- The position of the block.state- The block state at this position.blockEntity- The block entity at this position, if it exists.
public record BlockReference(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity)
extends Record
A reference to a block in the world, used by block detail providers.
-
Constructor Summary
ConstructorsConstructorDescriptionBlockReference(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) BlockReference(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) Creates an instance of aBlockReferencerecord class. -
Method Summary
Modifier and TypeMethodDescription@Nullable net.minecraft.world.level.block.entity.BlockEntityReturns the value of theblockEntityrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.net.minecraft.world.level.Levellevel()Returns the value of thelevelrecord component.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
-
BlockReference
public BlockReference(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos) -
BlockReference
public BlockReference(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity) Creates an instance of aBlockReferencerecord class.- Parameters:
level- the value for thelevelrecord componentpos- the value for theposrecord componentstate- the value for thestaterecord componentblockEntity- the value for theblockEntityrecord component
-
-
Method Details
-
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). -
level
-
pos
-
state
-
blockEntity
public @Nullable net.minecraft.world.level.block.entity.BlockEntity blockEntity()Returns the value of theblockEntityrecord component.- Returns:
- the value of the
blockEntityrecord component
-