github.com/df-mc/dragonfly@v0.9.13/server/block/stone.go (about) 1 package block 2 3 import "github.com/df-mc/dragonfly/server/item" 4 5 type ( 6 // Stone is a block found underground in the world or on mountains. 7 Stone struct { 8 solid 9 bassDrum 10 11 // Smooth specifies if the stone is its smooth variant. 12 Smooth bool 13 } 14 15 // Granite is a type of igneous rock. 16 Granite polishable 17 // Diorite is a type of igneous rock. 18 Diorite polishable 19 // Andesite is a type of igneous rock. 20 Andesite polishable 21 22 // polishable forms the base of blocks that may be polished. 23 polishable struct { 24 solid 25 bassDrum 26 // Polished specifies if the block is polished or not. When set to true, the block will represent its 27 // polished variant, for example polished andesite. 28 Polished bool 29 } 30 ) 31 32 // BreakInfo ... 33 func (s Stone) BreakInfo() BreakInfo { 34 if s.Smooth { 35 return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, oneOf(s)).withBlastResistance(30) 36 } 37 return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, silkTouchOneOf(Cobblestone{}, Stone{})).withBlastResistance(30) 38 } 39 40 // BreakInfo ... 41 func (g Granite) BreakInfo() BreakInfo { 42 return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, oneOf(g)).withBlastResistance(30) 43 } 44 45 // BreakInfo ... 46 func (d Diorite) BreakInfo() BreakInfo { 47 return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, oneOf(d)).withBlastResistance(30) 48 } 49 50 // BreakInfo ... 51 func (a Andesite) BreakInfo() BreakInfo { 52 return newBreakInfo(1.5, pickaxeHarvestable, pickaxeEffective, oneOf(a)).withBlastResistance(30) 53 } 54 55 // SmeltInfo ... 56 func (s Stone) SmeltInfo() item.SmeltInfo { 57 if s.Smooth { 58 return item.SmeltInfo{} 59 } 60 return newSmeltInfo(item.NewStack(Stone{Smooth: true}, 1), 0.1) 61 } 62 63 // EncodeItem ... 64 func (s Stone) EncodeItem() (name string, meta int16) { 65 if s.Smooth { 66 return "minecraft:smooth_stone", 0 67 } 68 return "minecraft:stone", 0 69 } 70 71 // EncodeBlock ... 72 func (s Stone) EncodeBlock() (string, map[string]any) { 73 if s.Smooth { 74 return "minecraft:smooth_stone", nil 75 } 76 return "minecraft:stone", nil 77 } 78 79 // EncodeItem ... 80 func (a Andesite) EncodeItem() (name string, meta int16) { 81 if a.Polished { 82 return "minecraft:polished_andesite", 0 83 } 84 return "minecraft:andesite", 0 85 } 86 87 // EncodeBlock ... 88 func (a Andesite) EncodeBlock() (string, map[string]any) { 89 if a.Polished { 90 return "minecraft:polished_andesite", nil 91 } 92 return "minecraft:andesite", nil 93 } 94 95 // EncodeItem ... 96 func (d Diorite) EncodeItem() (name string, meta int16) { 97 if d.Polished { 98 return "minecraft:polished_diorite", 0 99 } 100 return "minecraft:diorite", 0 101 } 102 103 // EncodeBlock ... 104 func (d Diorite) EncodeBlock() (string, map[string]any) { 105 if d.Polished { 106 return "minecraft:polished_diorite", nil 107 } 108 return "minecraft:diorite", nil 109 } 110 111 // EncodeItem ... 112 func (g Granite) EncodeItem() (name string, meta int16) { 113 if g.Polished { 114 return "minecraft:polished_granite", 0 115 } 116 return "minecraft:granite", 0 117 } 118 119 // EncodeBlock ... 120 func (g Granite) EncodeBlock() (string, map[string]any) { 121 if g.Polished { 122 return "minecraft:polished_granite", nil 123 } 124 return "minecraft:granite", nil 125 }