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

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/item"
     5  	"math/rand"
     6  )
     7  
     8  // LapisOre is an ore block from which lapis lazuli is obtained.
     9  type LapisOre struct {
    10  	solid
    11  	bassDrum
    12  
    13  	// Type is the type of lapis ore.
    14  	Type OreType
    15  }
    16  
    17  // BreakInfo ...
    18  func (l LapisOre) BreakInfo() BreakInfo {
    19  	i := newBreakInfo(l.Type.Hardness(), func(t item.Tool) bool {
    20  		return t.ToolType() == item.TypePickaxe && t.HarvestLevel() >= item.ToolTierStone.HarvestLevel
    21  	}, pickaxeEffective, silkTouchDrop(item.NewStack(item.LapisLazuli{}, rand.Intn(5)+4), item.NewStack(l, 1))).withXPDropRange(2, 5)
    22  	if l.Type == DeepslateOre() {
    23  		i = i.withBlastResistance(9)
    24  	}
    25  	return i
    26  }
    27  
    28  // SmeltInfo ...
    29  func (LapisOre) SmeltInfo() item.SmeltInfo {
    30  	return newOreSmeltInfo(item.NewStack(item.LapisLazuli{}, 1), 0.2)
    31  }
    32  
    33  // EncodeItem ...
    34  func (l LapisOre) EncodeItem() (name string, meta int16) {
    35  	return "minecraft:" + l.Type.Prefix() + "lapis_ore", 0
    36  }
    37  
    38  // EncodeBlock ...
    39  func (l LapisOre) EncodeBlock() (string, map[string]any) {
    40  	return "minecraft:" + l.Type.Prefix() + "lapis_ore", nil
    41  }