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

     1  package block
     2  
     3  // FlowerType represents a type of flower.
     4  type FlowerType struct {
     5  	flower
     6  }
     7  
     8  type flower uint8
     9  
    10  // Dandelion is a dandelion flower.
    11  func Dandelion() FlowerType {
    12  	return FlowerType{0}
    13  }
    14  
    15  // Poppy is a poppy flower.
    16  func Poppy() FlowerType {
    17  	return FlowerType{1}
    18  }
    19  
    20  // BlueOrchid is a blue orchid flower.
    21  func BlueOrchid() FlowerType {
    22  	return FlowerType{2}
    23  }
    24  
    25  // Allium is an allium flower.
    26  func Allium() FlowerType {
    27  	return FlowerType{3}
    28  }
    29  
    30  // AzureBluet is an azure bluet flower.
    31  func AzureBluet() FlowerType {
    32  	return FlowerType{4}
    33  }
    34  
    35  // RedTulip is a red tulip flower.
    36  func RedTulip() FlowerType {
    37  	return FlowerType{5}
    38  }
    39  
    40  // OrangeTulip is an orange tulip flower.
    41  func OrangeTulip() FlowerType {
    42  	return FlowerType{6}
    43  }
    44  
    45  // WhiteTulip is a white tulip flower.
    46  func WhiteTulip() FlowerType {
    47  	return FlowerType{7}
    48  }
    49  
    50  // PinkTulip is a pink tulip flower.
    51  func PinkTulip() FlowerType {
    52  	return FlowerType{8}
    53  }
    54  
    55  // OxeyeDaisy is an oxeye daisy flower.
    56  func OxeyeDaisy() FlowerType {
    57  	return FlowerType{9}
    58  }
    59  
    60  // Cornflower is a cornflower flower.
    61  func Cornflower() FlowerType {
    62  	return FlowerType{10}
    63  }
    64  
    65  // LilyOfTheValley is a lily of the valley flower.
    66  func LilyOfTheValley() FlowerType {
    67  	return FlowerType{11}
    68  }
    69  
    70  // WitherRose is a wither rose flower.
    71  func WitherRose() FlowerType {
    72  	return FlowerType{12}
    73  }
    74  
    75  // Uint8 returns the flower as a uint8.
    76  func (f flower) Uint8() uint8 {
    77  	return uint8(f)
    78  }
    79  
    80  // Name ...
    81  func (f flower) Name() string {
    82  	switch f {
    83  	case 0:
    84  		return "Dandelion"
    85  	case 1:
    86  		return "Poppy"
    87  	case 2:
    88  		return "Blue Orchid"
    89  	case 3:
    90  		return "Allium"
    91  	case 4:
    92  		return "Azure Bluet"
    93  	case 5:
    94  		return "Red Tulip"
    95  	case 6:
    96  		return "Orange Tulip"
    97  	case 7:
    98  		return "White Tulip"
    99  	case 8:
   100  		return "Pink Tulip"
   101  	case 9:
   102  		return "Oxeye Daisy"
   103  	case 10:
   104  		return "Cornflower"
   105  	case 11:
   106  		return "Lily of the Valley"
   107  	case 12:
   108  		return "Wither Rose"
   109  	}
   110  	panic("unknown flower type")
   111  }
   112  
   113  // String ...
   114  func (f flower) String() string {
   115  	switch f {
   116  	case 0:
   117  		return "dandelion"
   118  	case 1:
   119  		return "poppy"
   120  	case 2:
   121  		return "orchid"
   122  	case 3:
   123  		return "allium"
   124  	case 4:
   125  		return "houstonia"
   126  	case 5:
   127  		return "tulip_red"
   128  	case 6:
   129  		return "tulip_orange"
   130  	case 7:
   131  		return "tulip_white"
   132  	case 8:
   133  		return "tulip_pink"
   134  	case 9:
   135  		return "oxeye"
   136  	case 10:
   137  		return "cornflower"
   138  	case 11:
   139  		return "lily_of_the_valley"
   140  	case 12:
   141  		return "wither_rose"
   142  	}
   143  	panic("unknown flower type")
   144  }
   145  
   146  // FlowerTypes ...
   147  func FlowerTypes() []FlowerType {
   148  	return []FlowerType{Dandelion(), Poppy(), BlueOrchid(), Allium(), AzureBluet(), RedTulip(), OrangeTulip(), WhiteTulip(), PinkTulip(), OxeyeDaisy(), Cornflower(), LilyOfTheValley(), WitherRose()}
   149  }