github.com/df-mc/dragonfly@v0.9.13/server/block/stained_terracotta.go (about) 1 package block 2 3 import ( 4 "github.com/df-mc/dragonfly/server/item" 5 "github.com/df-mc/dragonfly/server/world" 6 ) 7 8 // StainedTerracotta is a block formed from clay, with a hardness and blast resistance comparable to stone. In contrast 9 // to Terracotta, t can be coloured in the same 16 colours that wool can be dyed, but more dulled and earthen. 10 type StainedTerracotta struct { 11 solid 12 bassDrum 13 14 // Colour specifies the colour of the block. 15 Colour item.Colour 16 } 17 18 // SoilFor ... 19 func (t StainedTerracotta) SoilFor(block world.Block) bool { 20 _, ok := block.(DeadBush) 21 return ok 22 } 23 24 // BreakInfo ... 25 func (t StainedTerracotta) BreakInfo() BreakInfo { 26 return newBreakInfo(1.25, pickaxeHarvestable, pickaxeEffective, oneOf(t)).withBlastResistance(21) 27 } 28 29 // SmeltInfo ... 30 func (t StainedTerracotta) SmeltInfo() item.SmeltInfo { 31 return newSmeltInfo(item.NewStack(GlazedTerracotta{Colour: t.Colour}, 1), 0.1) 32 } 33 34 // EncodeItem ... 35 func (t StainedTerracotta) EncodeItem() (name string, meta int16) { 36 return "minecraft:" + t.Colour.String() + "_terracotta", 0 37 } 38 39 // EncodeBlock ... 40 func (t StainedTerracotta) EncodeBlock() (name string, properties map[string]any) { 41 return "minecraft:" + t.Colour.String() + "_terracotta", nil 42 } 43 44 // allStainedTerracotta returns stained terracotta blocks with all possible colours. 45 func allStainedTerracotta() []world.Block { 46 b := make([]world.Block, 0, 16) 47 for _, c := range item.Colours() { 48 b = append(b, StainedTerracotta{Colour: c}) 49 } 50 return b 51 }