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

     1  package item
     2  
     3  import "github.com/df-mc/dragonfly/server/world"
     4  
     5  // TurtleShell are items that are used for brewing or as a helmet to give the player the Water Breathing
     6  // status effect.
     7  type TurtleShell struct{}
     8  
     9  // Use handles the using of a turtle shell to auto-equip it in an armour slot.
    10  func (TurtleShell) Use(_ *world.World, _ User, ctx *UseContext) bool {
    11  	ctx.SwapHeldWithArmour(0)
    12  	return false
    13  }
    14  
    15  // DurabilityInfo ...
    16  func (TurtleShell) DurabilityInfo() DurabilityInfo {
    17  	return DurabilityInfo{
    18  		MaxDurability: 276,
    19  		BrokenItem:    simpleItem(Stack{}),
    20  	}
    21  }
    22  
    23  // RepairableBy ...
    24  func (TurtleShell) RepairableBy(i Stack) bool {
    25  	_, ok := i.Item().(Scute)
    26  	return ok
    27  }
    28  
    29  // MaxCount always returns 1.
    30  func (TurtleShell) MaxCount() int {
    31  	return 1
    32  }
    33  
    34  // DefencePoints ...
    35  func (TurtleShell) DefencePoints() float64 {
    36  	return 2
    37  }
    38  
    39  // Toughness ...
    40  func (TurtleShell) Toughness() float64 {
    41  	return 0
    42  }
    43  
    44  // KnockBackResistance ...
    45  func (TurtleShell) KnockBackResistance() float64 {
    46  	return 0
    47  }
    48  
    49  // EnchantmentValue ...
    50  func (TurtleShell) EnchantmentValue() int {
    51  	return 9
    52  }
    53  
    54  // Helmet ...
    55  func (TurtleShell) Helmet() bool {
    56  	return true
    57  }
    58  
    59  // EncodeItem ...
    60  func (TurtleShell) EncodeItem() (name string, meta int16) {
    61  	return "minecraft:turtle_helmet", 0
    62  }