Contents
Class CustomTemplateConnectedBlockRuleSet
java.lang.Object
com.hypixel.hytale.server.core.universe.world.connectedblocks.ConnectedBlockRuleSet
com.hypixel.hytale.server.core.universe.world.connectedblocks.CustomTemplateConnectedBlockRuleSet
A
ConnectedBlockRuleSet that delegates pattern matching to a CustomConnectedBlockTemplateAsset.
The template names a set of shapes; this rule set maps each shape name to a BlockPattern that
describes which concrete BlockTypes represent that shape. At placement or update time, the
template's patterns are evaluated against the world, and the matching shape's BlockPattern selects
the resulting block.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<CustomTemplateConnectedBlockRuleSet> The codec used to parseCustomTemplateConnectedBlockRuleSetinstances. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetConnectedBlockType(ChunkStore chunkStore, org.joml.Vector3ic testedCoordinate, BlockType blockType, int rotation, org.joml.Vector3ic placementNormal, boolean isPlacement) Called to fetch the connected block type for a block at the given coordinate, with the given block type and rotation, when being placed or updated.getShapesForBlockType(int blockTypeKey) booleanvoidupdateCachedBlockTypes(BlockType blockType, BlockTypeAssetMap<String, BlockType> assetMap) Called once after asset resolution so the rule set can cache lookups against the resolved variants.Methods inherited from class ConnectedBlockRuleSet
getUpdateMode, toPacket
-
Field Details
-
CODEC
The codec used to parseCustomTemplateConnectedBlockRuleSetinstances.
-
-
Constructor Details
-
CustomTemplateConnectedBlockRuleSet
public CustomTemplateConnectedBlockRuleSet()
-
-
Method Details
-
getShapeNameToBlockPatternMap
- Returns:
- the map of shape names to the
BlockPatternthat produces the resulting block when that shape matches.
-
updateCachedBlockTypes
public void updateCachedBlockTypes(@Nonnull BlockType blockType, @Nonnull BlockTypeAssetMap<String, BlockType> assetMap) Description copied from class:ConnectedBlockRuleSetCalled once after asset resolution so the rule set can cache lookups against the resolved variants. Implementations that maintain block-id to shape lookup maps should rebuild them here. The default implementation is a no-op; not all rule sets need cached state.- Overrides:
updateCachedBlockTypesin classConnectedBlockRuleSet- Parameters:
blockType- The baseBlockTypethat owns this rule set; variants resolve relative to it.assetMap- TheBlockTypeAssetMapfor resolving variant block types to their asset index.
-
getShapesForBlockType
-
getShapeTemplateAsset
- Returns:
- the
CustomConnectedBlockTemplateAssetthis rule set delegates to, ornullif no asset with the configured id is registered.
-
onlyUpdateOnPlacement
public boolean onlyUpdateOnPlacement()- Specified by:
onlyUpdateOnPlacementin classConnectedBlockRuleSet- Returns:
trueif the block should only update its connected block type on placement,falseotherwise.
-
getConnectedBlockType
@Nonnull public Optional<ConnectedBlocksUtil.ConnectedBlockResult> getConnectedBlockType(@Nonnull ChunkStore chunkStore, @Nonnull org.joml.Vector3ic testedCoordinate, @Nonnull BlockType blockType, int rotation, @Nonnull org.joml.Vector3ic placementNormal, boolean isPlacement) Description copied from class:ConnectedBlockRuleSetCalled to fetch the connected block type for a block at the given coordinate, with the given block type and rotation, when being placed or updated.- Specified by:
getConnectedBlockTypein classConnectedBlockRuleSet- Parameters:
chunkStore- TheChunkStorefor chunk component and data access.testedCoordinate- The coordinate of the block being tested for connected block type updates.blockType- TheBlockTypeof the block being tested for connected block type updates.rotation- The rotation of the block being tested for connected block type updates.placementNormal- The face normal of the block being placed against, if the block is being placed. Otherwise, this will be a zero vector.isPlacement- Indicates whether the block is being placed (as opposed to updated).- Returns:
- an
Optionalcontaining theConnectedBlocksUtil.ConnectedBlockResultif a connected block type was found, or an emptyOptionalif no connected block type applies.
-