github.com/df-mc/dragonfly@v0.9.13/server/block/skull_type.go (about) 1 package block 2 3 // SkullType represents a mob variant of a skull. 4 type SkullType struct { 5 skull 6 } 7 8 // SkeletonSkull returns the skull variant for skeletons. 9 func SkeletonSkull() SkullType { 10 return SkullType{0} 11 } 12 13 // WitherSkeletonSkull returns the skull variant for wither skeletons. 14 func WitherSkeletonSkull() SkullType { 15 return SkullType{1} 16 } 17 18 // ZombieHead returns the skull variant for zombies. 19 func ZombieHead() SkullType { 20 return SkullType{2} 21 } 22 23 // PlayerHead returns the skull variant for players. 24 func PlayerHead() SkullType { 25 return SkullType{3} 26 } 27 28 // CreeperHead returns the skull variant for creepers. 29 func CreeperHead() SkullType { 30 return SkullType{4} 31 } 32 33 // DragonHead returns the skull variant for ender dragons. 34 func DragonHead() SkullType { 35 return SkullType{5} 36 } 37 38 // PiglinHead returns the skull variant for piglins. 39 func PiglinHead() SkullType { 40 return SkullType{6} 41 } 42 43 // SkullTypes returns all variants of skulls. 44 func SkullTypes() []SkullType { 45 return []SkullType{SkeletonSkull(), WitherSkeletonSkull(), ZombieHead(), PlayerHead(), CreeperHead(), DragonHead(), PiglinHead()} 46 } 47 48 type skull uint8 49 50 // Uint8 ... 51 func (s skull) Uint8() uint8 { 52 return uint8(s) 53 } 54 55 // Name ... 56 func (s skull) Name() string { 57 switch s { 58 case 0: 59 return "Skeleton Skull" 60 case 1: 61 return "Wither Skeleton Skull" 62 case 2: 63 return "Zombie Head" 64 case 3: 65 return "Player Head" 66 case 4: 67 return "Creeper Head" 68 case 5: 69 return "Dragon Head" 70 case 6: 71 return "Piglin Head" 72 } 73 panic("unknown skull type") 74 } 75 76 // String ... 77 func (s skull) String() string { 78 switch s { 79 case 0: 80 return "skeleton" 81 case 1: 82 return "wither_skeleton" 83 case 2: 84 return "zombie" 85 case 3: 86 return "player" 87 case 4: 88 return "creeper" 89 case 5: 90 return "dragon" 91 case 6: 92 return "piglin" 93 } 94 panic("unknown skull type") 95 }