github.com/df-mc/dragonfly@v0.9.13/server/block/sandstone_type.go (about) 1 package block 2 3 // SandstoneType represents a type of sandstone. 4 type SandstoneType struct { 5 sandstone 6 } 7 8 type sandstone uint8 9 10 // NormalSandstone is the normal variant of sandstone. 11 func NormalSandstone() SandstoneType { 12 return SandstoneType{0} 13 } 14 15 // CutSandstone is the cut variant of sandstone. 16 func CutSandstone() SandstoneType { 17 return SandstoneType{1} 18 } 19 20 // ChiseledSandstone is the chiseled variant of sandstone. 21 func ChiseledSandstone() SandstoneType { 22 return SandstoneType{2} 23 } 24 25 // SmoothSandstone is the smooth variant of sandstone. 26 func SmoothSandstone() SandstoneType { 27 return SandstoneType{3} 28 } 29 30 // Uint8 returns the sandstone as a uint8. 31 func (s sandstone) Uint8() uint8 { 32 return uint8(s) 33 } 34 35 // Name ... 36 func (s sandstone) Name() string { 37 switch s { 38 case 0: 39 return "Sandstone" 40 case 1: 41 return "Cut Sandstone" 42 case 2: 43 return "Chiseled Sandstone" 44 case 3: 45 return "Smooth Sandstone" 46 } 47 panic("unknown sandstone type") 48 } 49 50 // String ... 51 func (s sandstone) String() string { 52 switch s { 53 case 0: 54 return "default" 55 case 1: 56 return "cut" 57 case 2: 58 return "heiroglyphs" 59 case 3: 60 return "smooth" 61 } 62 panic("unknown sandstone type") 63 } 64 65 // SandstoneTypes ... 66 func SandstoneTypes() []SandstoneType { 67 return []SandstoneType{NormalSandstone(), CutSandstone(), ChiseledSandstone(), SmoothSandstone()} 68 }