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

     1  package block
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/block/cube"
     5  	"github.com/df-mc/dragonfly/server/item"
     6  	"github.com/df-mc/dragonfly/server/world"
     7  )
     8  
     9  // SmithingTable is a toolsmith's job site block that generates in villages. It can be used to upgrade diamond gear into
    10  // netherite gear.
    11  type SmithingTable struct {
    12  	bass
    13  	solid
    14  }
    15  
    16  // EncodeItem ...
    17  func (SmithingTable) EncodeItem() (name string, meta int16) {
    18  	return "minecraft:smithing_table", 0
    19  }
    20  
    21  // EncodeBlock ...
    22  func (SmithingTable) EncodeBlock() (name string, properties map[string]interface{}) {
    23  	return "minecraft:smithing_table", nil
    24  }
    25  
    26  // BreakInfo ...
    27  func (s SmithingTable) BreakInfo() BreakInfo {
    28  	return newBreakInfo(2.5, alwaysHarvestable, axeEffective, oneOf(s))
    29  }
    30  
    31  // Activate ...
    32  func (SmithingTable) Activate(pos cube.Pos, _ cube.Face, _ *world.World, u item.User, _ *item.UseContext) bool {
    33  	if opener, ok := u.(ContainerOpener); ok {
    34  		opener.OpenBlockContainer(pos)
    35  		return true
    36  	}
    37  	return false
    38  }