feat(models): add block model boxes + picking

This commit is contained in:
Jacobwasbeast
2026-03-11 15:12:35 -05:00
parent 6fabb8fd39
commit 788b7167a2
26 changed files with 1429 additions and 4 deletions

View File

@@ -14,6 +14,7 @@ public class ExampleMod : IMod
public static RegisteredBlock? RubyOre;
public static RegisteredBlock? RubyStone;
public static RegisteredBlock? RubyWoodPlanks;
public static RegisteredBlock? RubyChair;
public static RegisteredBlock? RubySand;
public static RegisteredSlabBlock? RubyStoneSlab;
public static RegisteredSlabBlock? RubyWoodSlab;
@@ -236,6 +237,16 @@ public class ExampleMod : IMod
.Name(Text.Translatable("block.examplemod.ruby_wood_planks"))
.InCreativeTab(CreativeTab.BuildingBlocks));
RubyChair = Registry.Block.Register("examplemod:ruby_chair",
new BlockProperties()
.Material(MaterialType.Wood)
.Hardness(1.5f)
.Resistance(5f)
.Sound(SoundType.Wood)
.Model("examplemod:block/ruby_chair")
.Name(Text.Translatable("block.examplemod.ruby_chair"))
.InCreativeTab(CreativeTab.Decoration));
RubySand = Registry.Block.Register("examplemod:ruby_sand",
new RubySandBlock(),
new BlockProperties()

View File

@@ -39,3 +39,14 @@ Block and item models are supported using Java-style JSON assets:
- **Entities (future):** `assets/examplemod/models/entity/{name}.json`
The `examplemod` namespace should match your mod ID (lowercase).
To drive an icon from a model JSON, use:
```csharp
.Model("examplemod:block/ruby_ore")
.Model("examplemod:item/ruby")
```
WeaveLoader reads the model JSON and uses its texture for the icon.
For block items, WeaveLoader uses the block model by default. Item models are optional.

View File

@@ -3,6 +3,7 @@
block.examplemod.ruby_ore=Ruby Ore
block.examplemod.ruby_stone=Ruby Stone
block.examplemod.ruby_wood_planks=Ruby Wood Planks
block.examplemod.ruby_chair=Ruby Chair
block.examplemod.ruby_stone_slab=Ruby Stone Slab
block.examplemod.ruby_stone_slab_double=Ruby Stone Slab
block.examplemod.ruby_wood_slab=Ruby Wood Slab

View File

@@ -0,0 +1,13 @@
{
"textures": {
"all": "examplemod:block/ruby_wood_planks"
},
"elements": [
{ "from": [2, 8, 2], "to": [14, 10, 14], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } },
{ "from": [2, 10, 12], "to": [14, 22, 14], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } },
{ "from": [2, 0, 2], "to": [4, 8, 4], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } },
{ "from": [12, 0, 2], "to": [14, 8, 4], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } },
{ "from": [2, 0, 12], "to": [4, 8, 14], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } },
{ "from": [12, 0, 12], "to": [14, 8, 14], "faces": { "north": { "texture": "#all" }, "south": { "texture": "#all" }, "west": { "texture": "#all" }, "east": { "texture": "#all" }, "up": { "texture": "#all" }, "down": { "texture": "#all" } } }
]
}