Skip to content

Commit e708cb7

Browse files
committed
fix: Some blocks dont use 'default' as the default blockstate
1 parent 917375e commit e708cb7

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

bubblellaneous/unit/block.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ type Block struct {
3030
hidden bool
3131
}
3232

33+
func (block Block) DefaultBlockstate() string {
34+
if len(block.states.States) > 0 {
35+
return block.states.States[0].Name
36+
}
37+
return "default"
38+
}
39+
3340
func (block Block) WithBlockstates(match string, states ...field.BlockState) Block {
3441
block.states = field.States{
3542
Match: match,

bubblellaneous/unit/interface.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Unit interface {
1919
MinecraftBase() string
2020
SetVariant(id string, material field.Material, count int, index int) Unit
2121
Type() string
22+
DefaultBlockstate() string
2223
Compile(*lib.Tree, int) (int, bool)
2324
Recipe() []field.RecipeEntry
2425
SetRecipe([]field.RecipeEntry) Unit
@@ -87,16 +88,18 @@ func Compile(unit Unit, template code.Template, tree *lib.Tree, customModelData
8788
if overwritten {
8889
if unit.Material() != nil {
8990
tree.MkItem(unit.Id(), fmt.Sprintf(
90-
"bubblellaneous:%s/%s/%s/default",
91+
"bubblellaneous:%s/%s/%s/%s",
9192
unit.Type(),
9293
unit.UnitId(),
9394
unit.Material().Name,
95+
unit.DefaultBlockstate(),
9496
))
9597
} else {
9698
tree.MkItem(unit.Id(), fmt.Sprintf(
97-
"bubblellaneous:%s/%s/default",
99+
"bubblellaneous:%s/%s/%s",
98100
unit.Type(),
99101
unit.Id(),
102+
unit.DefaultBlockstate(),
100103
))
101104
}
102105

bubblellaneous/unit/item.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ type Item struct {
2525
nbtCallback func(nbt.TreeNBT) nbt.TreeNBT
2626
}
2727

28+
func (item Item) DefaultBlockstate() string {
29+
return "default"
30+
}
31+
2832
func (item Item) WithFood(nutrition, saturation int, always bool, time float64, animation string) Item {
2933
item.food = &field.Food{
3034
Nutrition: nutrition,

0 commit comments

Comments
 (0)