Package com.petrolpark.util
Record Class BlockStateAndEntity
java.lang.Object
java.lang.Record
com.petrolpark.util.BlockStateAndEntity
public record BlockStateAndEntity(net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity entity)
extends Record
-
Constructor Summary
ConstructorsConstructorDescriptionBlockStateAndEntity(net.minecraft.world.level.block.state.BlockState state, net.minecraft.world.level.block.entity.BlockEntity entity) Creates an instance of aBlockStateAndEntityrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic final BlockStateAndEntityat(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) net.minecraft.world.level.block.Blockblock()net.minecraft.world.level.block.entity.BlockEntityentity()Returns the value of theentityrecord component.Optional<net.minecraft.world.level.block.entity.BlockEntity> entityOp()final booleanIndicates whether some other object is "equal to" this one.booleanfinal inthashCode()Returns a hash code value for this object.booleanis(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag) static final BlockStateAndEntityof(net.minecraft.world.level.block.state.BlockState state) net.minecraft.world.level.block.state.BlockStatestate()Returns the value of thestaterecord component.final StringtoString()Returns a string representation of this record class.withState(net.minecraft.world.level.block.state.BlockState state) withStateOptional(net.minecraft.world.level.block.state.BlockState state)
-
Constructor Details
-
BlockStateAndEntity
public BlockStateAndEntity(net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity entity) Creates an instance of aBlockStateAndEntityrecord class.- Parameters:
state- the value for thestaterecord componententity- the value for theentityrecord component
-
-
Method Details
-
of
-
at
public static final BlockStateAndEntity at(net.minecraft.world.level.BlockGetter level, net.minecraft.core.BlockPos pos) -
block
public net.minecraft.world.level.block.Block block() -
is
public boolean is(net.minecraft.tags.TagKey<net.minecraft.world.level.block.Block> tag) -
hasEntity
public boolean hasEntity() -
entityOp
-
withState
-
withStateOptional
public Optional<BlockStateAndEntity> withStateOptional(net.minecraft.world.level.block.state.BlockState state) -
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). -
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. -
state
public net.minecraft.world.level.block.state.BlockState state()Returns the value of thestaterecord component.- Returns:
- the value of the
staterecord component
-
entity
@Nullable public net.minecraft.world.level.block.entity.BlockEntity entity()Returns the value of theentityrecord component.- Returns:
- the value of the
entityrecord component
-