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

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  	"github.com/df-mc/dragonfly/server/world"
     6  )
     7  
     8  // Concrete is a solid block which comes in the 16 regular dye colors, created by placing concrete powder
     9  // adjacent to water.
    10  type Concrete struct {
    11  	solid
    12  	bassDrum
    13  
    14  	// Colour is the colour of the concrete block.
    15  	Colour item.Colour
    16  }
    17  
    18  // BreakInfo ...
    19  func (c Concrete) BreakInfo() BreakInfo {
    20  	return newBreakInfo(1.8, pickaxeHarvestable, pickaxeEffective, oneOf(c))
    21  }
    22  
    23  // EncodeItem ...
    24  func (c Concrete) EncodeItem() (name string, meta int16) {
    25  	return "minecraft:" + c.Colour.String() + "_concrete", 0
    26  }
    27  
    28  // EncodeBlock ...
    29  func (c Concrete) EncodeBlock() (name string, properties map[string]any) {
    30  	return "minecraft:" + c.Colour.String() + "_concrete", nil
    31  }
    32  
    33  // allConcrete returns concrete blocks with all possible colours.
    34  func allConcrete() []world.Block {
    35  	b := make([]world.Block, 0, 16)
    36  	for _, c := range item.Colours() {
    37  		b = append(b, Concrete{Colour: c})
    38  	}
    39  	return b
    40  }