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

     1  package block
     2  
     3  // NetherBricksType represents a type of nether bricks.
     4  type NetherBricksType struct {
     5  	netherBricks
     6  }
     7  
     8  type netherBricks uint8
     9  
    10  // NormalNetherBricks is the normal variant of the nether bricks.
    11  func NormalNetherBricks() NetherBricksType {
    12  	return NetherBricksType{0}
    13  }
    14  
    15  // RedNetherBricks is the red variant of the nether bricks.
    16  func RedNetherBricks() NetherBricksType {
    17  	return NetherBricksType{1}
    18  }
    19  
    20  // CrackedNetherBricks is the cracked variant of the nether bricks.
    21  func CrackedNetherBricks() NetherBricksType {
    22  	return NetherBricksType{2}
    23  }
    24  
    25  // ChiseledNetherBricks is the chiseled variant of the nether bricks.
    26  func ChiseledNetherBricks() NetherBricksType {
    27  	return NetherBricksType{3}
    28  }
    29  
    30  // Uint8 returns the nether bricks as a unit8.
    31  func (n netherBricks) Uint8() uint8 {
    32  	return uint8(n)
    33  }
    34  
    35  // Name ...
    36  func (n netherBricks) Name() string {
    37  	switch n {
    38  	case 0:
    39  		return "Nether Bricks"
    40  	case 1:
    41  		return "Red Nether Bricks"
    42  	case 2:
    43  		return "Cracked Nether Bricks"
    44  	case 3:
    45  		return "Chiseled Nether Bricks"
    46  	}
    47  	panic("unknown nether brick type")
    48  }
    49  
    50  // String ...
    51  func (n netherBricks) String() string {
    52  	switch n {
    53  	case 0:
    54  		return "nether_brick"
    55  	case 1:
    56  		return "red_nether_brick"
    57  	case 2:
    58  		return "cracked_nether_bricks"
    59  	case 3:
    60  		return "chiseled_nether_bricks"
    61  	}
    62  	panic("unknown nether brick type")
    63  }
    64  
    65  // NetherBricksTypes returns all nether bricks types.
    66  func NetherBricksTypes() []NetherBricksType {
    67  	return []NetherBricksType{NormalNetherBricks(), RedNetherBricks(), CrackedNetherBricks(), ChiseledNetherBricks()}
    68  }