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

     1  package block
     2  
     3  // BlackstoneType represents a type of blackstone.
     4  type BlackstoneType struct {
     5  	blackstone
     6  }
     7  
     8  type blackstone uint8
     9  
    10  // NormalBlackstone is the normal variant of blackstone.
    11  func NormalBlackstone() BlackstoneType {
    12  	return BlackstoneType{0}
    13  }
    14  
    15  // GildedBlackstone is the gilded variant of blackstone.
    16  func GildedBlackstone() BlackstoneType {
    17  	return BlackstoneType{1}
    18  }
    19  
    20  // PolishedBlackstone is the polished variant of blackstone.
    21  func PolishedBlackstone() BlackstoneType {
    22  	return BlackstoneType{2}
    23  }
    24  
    25  // ChiseledPolishedBlackstone is the chiseled polished variant of blackstone.
    26  func ChiseledPolishedBlackstone() BlackstoneType {
    27  	return BlackstoneType{3}
    28  }
    29  
    30  // Uint8 returns the blackstone type as a uint8.
    31  func (s blackstone) Uint8() uint8 {
    32  	return uint8(s)
    33  }
    34  
    35  // Name ...
    36  func (s blackstone) Name() string {
    37  	switch s {
    38  	case 0:
    39  		return "Blackstone"
    40  	case 1:
    41  		return "Gilded Blackstone"
    42  	case 2:
    43  		return "Polished Blackstone"
    44  	case 3:
    45  		return "Chiseled Polished Blackstone"
    46  	}
    47  	panic("unknown blackstone type")
    48  }
    49  
    50  // String ...
    51  func (s blackstone) String() string {
    52  	switch s {
    53  	case 0:
    54  		return "blackstone"
    55  	case 1:
    56  		return "gilded_blackstone"
    57  	case 2:
    58  		return "polished_blackstone"
    59  	case 3:
    60  		return "chiseled_polished_blackstone"
    61  	}
    62  	panic("unknown blackstone type")
    63  }
    64  
    65  // BlackstoneTypes ...
    66  func BlackstoneTypes() []BlackstoneType {
    67  	return []BlackstoneType{NormalBlackstone(), GildedBlackstone(), PolishedBlackstone(), ChiseledPolishedBlackstone()}
    68  }