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

     1  package item
     2  
     3  import "github.com/df-mc/dragonfly/server/world"
     4  
     5  // Elytra is a pair of rare wings found in end ships that are the only single-item source of flight in Survival mode.
     6  type Elytra struct{}
     7  
     8  // Use handles the using of an elytra to auto-equip it in an armour slot.
     9  func (Elytra) Use(_ *world.World, _ User, ctx *UseContext) bool {
    10  	ctx.SwapHeldWithArmour(1)
    11  	return false
    12  }
    13  
    14  // DurabilityInfo ...
    15  func (Elytra) DurabilityInfo() DurabilityInfo {
    16  	return DurabilityInfo{
    17  		MaxDurability: 433,
    18  		Persistent:    true,
    19  		BrokenItem:    simpleItem(Stack{}),
    20  	}
    21  }
    22  
    23  // RepairableBy ...
    24  func (Elytra) RepairableBy(i Stack) bool {
    25  	_, ok := i.Item().(PhantomMembrane)
    26  	return ok
    27  }
    28  
    29  // MaxCount always returns 1.
    30  func (Elytra) MaxCount() int {
    31  	return 1
    32  }
    33  
    34  // Chestplate ...
    35  func (Elytra) Chestplate() bool {
    36  	return true
    37  }
    38  
    39  // DefencePoints ...
    40  func (Elytra) DefencePoints() float64 {
    41  	return 0
    42  }
    43  
    44  // Toughness ...
    45  func (e Elytra) Toughness() float64 {
    46  	return 0
    47  }
    48  
    49  // KnockBackResistance ...
    50  func (e Elytra) KnockBackResistance() float64 {
    51  	return 0
    52  }
    53  
    54  // EncodeItem ...
    55  func (Elytra) EncodeItem() (name string, meta int16) {
    56  	return "minecraft:elytra", 0
    57  }