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

     1  package item
     2  
     3  // BannerPatternType represents a type of BannerPattern.
     4  type BannerPatternType struct {
     5  	bannerPatternType
     6  }
     7  
     8  // CreeperBannerPattern represents the 'Creeper' banner pattern type.
     9  func CreeperBannerPattern() BannerPatternType {
    10  	return BannerPatternType{0}
    11  }
    12  
    13  // SkullBannerPattern represents the 'Skull' banner pattern type.
    14  func SkullBannerPattern() BannerPatternType {
    15  	return BannerPatternType{1}
    16  }
    17  
    18  // FlowerBannerPattern represents the 'Flower' banner pattern type.
    19  func FlowerBannerPattern() BannerPatternType {
    20  	return BannerPatternType{2}
    21  }
    22  
    23  // MojangBannerPattern represents the 'Mojang' banner pattern type.
    24  func MojangBannerPattern() BannerPatternType {
    25  	return BannerPatternType{3}
    26  }
    27  
    28  // FieldMasonedBannerPattern represents the 'Field Masoned' banner pattern type.
    29  func FieldMasonedBannerPattern() BannerPatternType {
    30  	return BannerPatternType{4}
    31  }
    32  
    33  // BordureIndentedBannerPattern represents the 'Bordure Indented' banner pattern type.
    34  func BordureIndentedBannerPattern() BannerPatternType {
    35  	return BannerPatternType{5}
    36  }
    37  
    38  // PiglinBannerPattern represents the 'Piglin' banner pattern type.
    39  func PiglinBannerPattern() BannerPatternType {
    40  	return BannerPatternType{6}
    41  }
    42  
    43  // GlobeBannerPattern represents the 'Globe' banner pattern type.
    44  func GlobeBannerPattern() BannerPatternType {
    45  	return BannerPatternType{7}
    46  }
    47  
    48  // BannerPatterns returns all possible banner patterns.
    49  func BannerPatterns() []BannerPatternType {
    50  	return []BannerPatternType{
    51  		CreeperBannerPattern(),
    52  		SkullBannerPattern(),
    53  		FlowerBannerPattern(),
    54  		MojangBannerPattern(),
    55  		FieldMasonedBannerPattern(),
    56  		BordureIndentedBannerPattern(),
    57  		PiglinBannerPattern(),
    58  		GlobeBannerPattern(),
    59  	}
    60  }
    61  
    62  type bannerPatternType uint8
    63  
    64  // Uint8 returns the uint8 value of the banner pattern type.
    65  func (b bannerPatternType) Uint8() uint8 {
    66  	return uint8(b)
    67  }
    68  
    69  // String ...
    70  func (b bannerPatternType) String() string {
    71  	switch b {
    72  	case 0:
    73  		return "creeper"
    74  	case 1:
    75  		return "skull"
    76  	case 2:
    77  		return "flower"
    78  	case 3:
    79  		return "mojang"
    80  	case 4:
    81  		return "field_masoned"
    82  	case 5:
    83  		return "bordure_indented"
    84  	case 6:
    85  		return "piglin"
    86  	case 7:
    87  		return "globe"
    88  	}
    89  	panic("should never happen")
    90  }