github.com/df-mc/dragonfly@v0.9.13/server/block/nether_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  // NetherBricks are blocks used to form nether fortresses in the Nether.
     9  // Red Nether bricks, Cracked Nether bricks and Chiseled Nether bricks are decorative variants that do not naturally generate.
    10  type NetherBricks struct {
    11  	solid
    12  	bassDrum
    13  
    14  	// NetherBricksType is the type of nether bricks of the block.
    15  	Type NetherBricksType
    16  }
    17  
    18  // BreakInfo ...
    19  func (n NetherBricks) BreakInfo() BreakInfo {
    20  	return newBreakInfo(2, pickaxeHarvestable, pickaxeEffective, oneOf(n)).withBlastResistance(30)
    21  }
    22  
    23  // SmeltInfo ...
    24  func (n NetherBricks) SmeltInfo() item.SmeltInfo {
    25  	if n.Type == NormalNetherBricks() {
    26  		return newSmeltInfo(item.NewStack(NetherBricks{Type: CrackedNetherBricks()}, 1), 0.1)
    27  	}
    28  	return item.SmeltInfo{}
    29  }
    30  
    31  // EncodeItem ...
    32  func (n NetherBricks) EncodeItem() (id string, meta int16) {
    33  	return "minecraft:" + n.Type.String(), 0
    34  }
    35  
    36  // EncodeBlock ...
    37  func (n NetherBricks) EncodeBlock() (name string, properties map[string]any) {
    38  	return "minecraft:" + n.Type.String(), nil
    39  }
    40  
    41  // allNetherBricks returns a list of all nether bricks variants.
    42  func allNetherBricks() (netherBricks []world.Block) {
    43  	for _, t := range NetherBricksTypes() {
    44  		netherBricks = append(netherBricks, NetherBricks{Type: t})
    45  	}
    46  	return
    47  }