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

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  )
     6  
     7  // Obsidian is a dark purple block known for its high blast resistance and strength, most commonly found when
     8  // water flows over lava.
     9  type Obsidian struct {
    10  	solid
    11  	bassDrum
    12  	// Crying specifies if the block is a crying obsidian block. If true, the block is blue and emits light.
    13  	Crying bool
    14  }
    15  
    16  // LightEmissionLevel ...
    17  func (o Obsidian) LightEmissionLevel() uint8 {
    18  	if o.Crying {
    19  		return 10
    20  	}
    21  	return 0
    22  }
    23  
    24  // EncodeItem ...
    25  func (o Obsidian) EncodeItem() (name string, meta int16) {
    26  	if o.Crying {
    27  		return "minecraft:crying_obsidian", 0
    28  	}
    29  	return "minecraft:obsidian", 0
    30  }
    31  
    32  // EncodeBlock ...
    33  func (o Obsidian) EncodeBlock() (string, map[string]any) {
    34  	if o.Crying {
    35  		return "minecraft:crying_obsidian", nil
    36  	}
    37  	return "minecraft:obsidian", nil
    38  }
    39  
    40  // BreakInfo ...
    41  func (o Obsidian) BreakInfo() BreakInfo {
    42  	return newBreakInfo(35, func(t item.Tool) bool {
    43  		return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierDiamond.HarvestLevel
    44  	}, pickaxeEffective, oneOf(o)).withBlastResistance(6000)
    45  }