Files
mc/server/block/grindstone_attachment.go
TarnaWijaya 26ed99fda6
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
up3
2026-07-09 08:33:57 +08:00

47 lines
1.3 KiB
Go

package block
// GrindstoneAttachment represents a type of attachment for a Grindstone.
type GrindstoneAttachment struct {
grindstoneAttachment
}
// StandingGrindstoneAttachment is a type of attachment for a standing Grindstone.
func StandingGrindstoneAttachment() GrindstoneAttachment {
return GrindstoneAttachment{0}
}
// HangingGrindstoneAttachment is a type of attachment for a hanging Grindstone.
func HangingGrindstoneAttachment() GrindstoneAttachment {
return GrindstoneAttachment{1}
}
// WallGrindstoneAttachment is a type of attachment for a wall Grindstone.
func WallGrindstoneAttachment() GrindstoneAttachment {
return GrindstoneAttachment{2}
}
// GrindstoneAttachments returns all possible GrindstoneAttachments.
func GrindstoneAttachments() []GrindstoneAttachment {
return []GrindstoneAttachment{StandingGrindstoneAttachment(), HangingGrindstoneAttachment(), WallGrindstoneAttachment()}
}
type grindstoneAttachment uint8
// Uint8 returns the GrindstoneAttachment as a uint8.
func (g grindstoneAttachment) Uint8() uint8 {
return uint8(g)
}
// String returns the GrindstoneAttachment as a string.
func (g grindstoneAttachment) String() string {
switch g {
case 0:
return "standing"
case 1:
return "hanging"
case 2:
return "side"
}
panic("should never happen")
}