github.com/df-mc/dragonfly@v0.9.13/server/world/structure.go (about)

     1  package world
     2  
     3  // Structure represents a structure which may be placed in the world. It has fixed dimensions.
     4  type Structure interface {
     5  	// Dimensions returns the dimensions of the structure. It returns an int array with the width, height and
     6  	// length respectively.
     7  	Dimensions() [3]int
     8  	// At returns the block at a specific location in the structure. When the structure is placed in the
     9  	// world, this method is called for every location within the dimensions of the structure. Additionally,
    10  	// At can return a Liquid to be placed in the same place as the block.
    11  	// At can return nil to not place any block at the position. Returning Air will set any block at that
    12  	// position to air, but returning nil will not do anything.
    13  	// In addition to the coordinates, At will have a function passed that may be used to get a block at a
    14  	// specific position. In scope of At(), structures should use this over World.Block(), due to the way
    15  	// chunks are locked.
    16  	At(x, y, z int, blockAt func(x, y, z int) Block) (Block, Liquid)
    17  }