Record Class BlockRelocability.Multiblock
java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.util.BlockRelocability.Multiblock
- Record Components:
requiredPositions- Set of block positions which must be moved with this block to allow moving it. This Set must include the block's own position.
- All Implemented Interfaces:
BlockRelocability
- Enclosing interface:
BlockRelocability
public static record BlockRelocability.Multiblock(Set<BlockPos> requiredPositions)
extends Record
implements BlockRelocability
BlockRelocability indicating a block may be moved if and only if some set of other block positions is being moved with it.
Large multiblocks with a "core" block may reduce the number of necessary checks by having the non-core blocks only require themselves and the core, and having the core block require all non-core positions.
-
Nested Class Summary
Nested classes/interfaces inherited from interface BlockRelocability
BlockRelocability.Multiblock, BlockRelocability.No, BlockRelocability.Yes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMultiblock(Set<BlockPos> requiredPositions) Creates an instance of aMultiblockrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.booleanisRelocatable(Set<BlockPos> relocatingPositions) Returns true if the block is relocatable from a given Set of block positions, false otherwise.Returns the value of therequiredPositionsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
requiredPositions
The field for therequiredPositionsrecord component.
-
-
Constructor Details
-
Multiblock
Creates an instance of aMultiblockrecord class.- Parameters:
requiredPositions- the value for therequiredPositionsrecord component
-
-
Method Details
-
isRelocatable
Description copied from interface:BlockRelocabilityReturns true if the block is relocatable from a given Set of block positions, false otherwise.- Specified by:
isRelocatablein interfaceBlockRelocability- Parameters:
relocatingPositions- Set of positions blocks are being relocated from- Returns:
- true if the block is relocatable from a given Set of block positions, false otherwise
-
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). -
requiredPositions
Returns the value of therequiredPositionsrecord component.- Returns:
- the value of the
requiredPositionsrecord component
-