Skip to content

ShapeUpdates 5.46.0 ​

final class · pocketmine\world\generator\vanilla\structure\ShapeUpdates · source

Shape updates after structure placement, for the blocks whose state depends on their neighbours: fences, walls, iron bars / glass panes, stairs and wall banners (vanilla's BlockState.updateShape() of FenceBlock, WallBlock, IronBarsBlock, StairBlock and WallBannerBlock, and Block.updateFromNeighbourShapes()). Vanilla runs them:

  • for every block of a template placed without a known shape (StructureTemplate.placeInWorld(): all templates except jigsaw elements), after updateShapeAtEdge() on the faces of the placed blocks;
  • for the fences, iron bars, torches and ladders placed by code-built pieces (StructurePiece.SHAPE_CHECK_BLOCKS, post-processed when the chunk becomes full). Other blocks (torches, ladders, chests, redstone...) are left as placed. "Sturdy face" uses the collision shape.

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\generator\vanilla\feature\block\JavaBlocks $blocks)

afterTemplatePlacement() ​

php
public function afterTemplatePlacement(\pocketmine\world\generator\vanilla\feature\FeatureLevel $level, array $placed) : void

StructureTemplate.updateShapeAtEdge() + the updateFromNeighbourShapes() pass of placeInWorld() for the blocks a template placed (positions in placement order).

isShapeDependent() ​

php
public function isShapeDependent(int $state) : bool

Whether the block's state can change with its neighbours (fences, walls, bars, panes, stairs).

updateFromNeighbourShapes() ​

php
public function updateFromNeighbourShapes(\pocketmine\world\generator\vanilla\feature\FeatureLevel $level, int $x, int $y, int $z) : void

Block.updateFromNeighbourShapes() + setBlock() if the state changed.

updateShape() ​

php
public function updateShape(\pocketmine\world\generator\vanilla\feature\FeatureLevel $level, int $state, int $x, int $y, int $z, int $direction, int $neighbour) : int

BlockState.updateShape(direction, neighbour) for the supported blocks; other states are returned unchanged.

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.