github.com/df-mc/dragonfly@v0.9.13/server/block/stone_bricks.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  // StoneBricks are materials found in structures such as strongholds, igloo basements, jungle temples, ocean ruins
     9  // and ruined portals.
    10  type StoneBricks struct {
    11  	solid
    12  	bassDrum
    13  
    14  	// Type is the type of stone bricks of the block.
    15  	Type StoneBricksType
    16  }
    17  
    18  // BreakInfo ...
    19  func (s StoneBricks) BreakInfo() BreakInfo {
    20  	return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, oneOf(s)).withBlastResistance(30)
    21  }
    22  
    23  // SmeltInfo ...
    24  func (s StoneBricks) SmeltInfo() item.SmeltInfo {
    25  	if s.Type == NormalStoneBricks() {
    26  		return newSmeltInfo(item.NewStack(StoneBricks{Type: CrackedStoneBricks()}, 1), 0.1)
    27  	}
    28  	return item.SmeltInfo{}
    29  }
    30  
    31  // EncodeItem ...
    32  func (s StoneBricks) EncodeItem() (name string, meta int16) {
    33  	return "minecraft:stonebrick", int16(s.Type.Uint8())
    34  }
    35  
    36  // EncodeBlock ...
    37  func (s StoneBricks) EncodeBlock() (string, map[string]any) {
    38  	return "minecraft:stonebrick", map[string]any{"stone_brick_type": s.Type.String()}
    39  }
    40  
    41  // allStoneBricks returns a list of all stoneBricks block variants.
    42  func allStoneBricks() (s []world.Block) {
    43  	for _, t := range StoneBricksTypes() {
    44  		s = append(s, StoneBricks{Type: t})
    45  	}
    46  	return
    47  }