diff --git a/.vitepress/sidebars/develop.ts b/.vitepress/sidebars/develop.ts index 4a50e1c65..d9efb8e3c 100644 --- a/.vitepress/sidebars/develop.ts +++ b/.vitepress/sidebars/develop.ts @@ -235,7 +235,11 @@ export default [ { text: "develop.dataGeneration.lootTables", link: "/develop/data-generation/loot-tables" - } + }, + { + text: "develop.dataGeneration.blockModels", + link: "/develop/data-generation/block-models" + } ] }, { diff --git a/develop/data-generation/block-models.md b/develop/data-generation/block-models.md new file mode 100644 index 000000000..cb6fe44d7 --- /dev/null +++ b/develop/data-generation/block-models.md @@ -0,0 +1,216 @@ +--- +title: Block Model Generation +description: A guide to generating block models and blockstates via datagen. +authors: + - Fellteros + - natri0 + - IMB11 + - its-miroma +--- + +# Block Model Generation {#block-model-generation} + +::: info PREREQUISITES +Make sure you've completed the [datagen setup](./setup) process first. +::: + +## Setup {#setup} + +First, we will need to create our ModelProvider. Create a class that `extends FabricModelProvider`. Implement both abstract methods: `generateBlockStateModels` and `generateItemModels`. +Lastly, create a constructor matching super. + +@[code lang=java transcludeWith=:::datagen-model:provider](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +Register this class in your `DataGeneratorEntrypoint` within the `onInitializeDataGenerator` method. + +## Blockstates and Block Models {#blockstates-and-block-models} + +```java +@Override +public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { +} +``` + +For block models, we will primarily be focusing on the `generateBlockStateModels` method. Notice the parameter `BlockStateModelGenerator blockStateModelGenerator` - this object will be responsible for generating all the JSON files. +Here are some handy examples you can use to generate your desired models: + +### Simple Cube All {#simple-cube-all} + +@[code lang=java transcludeWith=:::datagen-model:cube-all](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +This is the most commonly used function. It generates a JSON model file for a normal `cube_all` block model. One texture is used for all six sides, in this case we use `steel_block`. + +@[code](@/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/steel_block.json) + +It also generates a blockstate JSON file. Since we have no blockstate properties (e.g. Axis, Facing, ...), one variant is sufficient, and is used every time the block is placed. + +@[code](@/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/steel_block.json) + +Steel Block + +### Singletons {#singletons} + +The `registerSingleton` method provides JSON model files based on the `TexturedModel` you pass in and a single blockstate variant. + +@[code lang=java transcludeWith=:::datagen-model:cube-top-for-ends](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +This method will generate models for a normal cube, that uses the texture file `pipe_block` for the sides and the texture file `pipe_block_top` for the top and bottom sides. + +@[code](@/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/pipe_block.json) + +:::tip +If you're stuck choosing which `TextureModel` you should use, open the `TexturedModel` class and look at the [`TextureMaps`](#using-texture-map)! +::: + +Pipe Block + +### Block Texture Pool {#block-texture-pool} + +@[code lang=java transcludeWith=:::datagen-model:block-texture-pool-normal](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +Another useful method is `registerCubeAllModelTexturePool`: define the textures by passing in the "base block", and then append the "children", which will have the same textures. +In this case, we passed in the `RUBY_BLOCK`, so the stairs, slab and fence will use the `RUBY_BLOCK` texture. + +::: warning +It will also generate a [simple cube all JSON model](#simple-cube-all) for the "base block" to ensure that it has a block model. + +Be aware of this, if you're changing block model of this particular block, as it will result in en error. +::: + +You can also append a `BlockFamily`, which will generate models for all of its "children". + +@[code lang=java transcludeWith=:::datagen-model:family-declaration](@/reference/latest/src/main/java/com/example/docs/block/ModBlocks.java) + +@[code lang=java transcludeWith=:::datagen-model:block-texture-pool-family](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +Ruby Block + +### Doors and Trapdoors {#doors-and-trapdoors} + +@[code lang=java transcludeWith=:::datagen-model:door-and-trapdoor](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +Doors and trapdoors are a little different. Here, you have to make three new textures - two for the door, and one for the trapdoor. + +1. The door: + - It has two parts - the upper half and the lower half. **Each needs its own texture:** in this case `ruby_door_top` for the upper half and `ruby_door_bottom` for the lower. + - The `registerDoor()` method will create models for all orientations of the door, both open and closed. + - **You also need an item texture!** Put it in `assets//textures/item/` folder. +2. The trapdoor: + - Here, you need only one texture, in this case named `ruby_trapdoor`. It will be used for all sides. + - Since `TrapdoorBlock` has a `FACING` property, you can use the commented out method to generate model files with rotated textures = the trapdoor will be "orientable". Otherwise, it will look the same no matter the direction it's facing. + +Ruby Door and Trapdoor + +## Custom Block Models {#custom-block-models} + +In this section, we'll create the models for a Vertical Oak Log Slab, with Oak Log textures. + +_Points 2. - 6. are declared in an inner static helper class called `CustomBlockStateModelGenerator`._ + +### Custom Block Class {#custom-block-class} + +Create a `VerticalSlab` block with a `FACING` property and a `SINGLE` boolean property, like in the [Block States](../blocks/blockstates) tutorial. `SINGLE` will indicate if there are both slabs. +Then you should override `getOutlineShape` and `getCollisionShape`, so that the outline is rendered correctly, and the block has the correct collision shape. + +@[code lang=java transcludeWith=:::datagen-model-custom:voxels](@/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java) + +@[code lang=java transcludeWith=:::datagen-model-custom:collision](@/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java) + +Also override the `canReplace()` method, otherwise you couldn't make the slab a full block. + +@[code lang=java transcludeWith=:::datagen-model-custom:replace](@/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java) + +And you're done! You can now test the block out and place it in game. + +### Parent Block Model {#parent-block-model} + +Now, let's create a parent block model. It will determine the size, position in hand or other slots and the `x` and `y` coordinates of the texture. +It's recommended to use an editor such as [Blockbench](https://www.blockbench.net/) for this, as making it manually is a really tedious process. It should look something like this: + +@[code lang=json](@/reference/latest/src/main/resources/assets/fabric-docs-reference/models/block/vertical_slab.json) + +See [how blockstates are formatted](https://minecraft.wiki/w/Blockstates_definition_format) for more information. +Notice the `#bottom`, `#top`, `#side` keywords. They act as variables that can be set by models that have this one as a parent: + +```json +{ + "parent": "minecraft:block/cube_bottom_top", + "textures": { + "bottom": "minecraft:block/sandstone_bottom", + "side": "minecraft:block/sandstone", + "top": "minecraft:block/sandstone_top" + } +} +``` + +The `bottom` value will replace the `#bottom` placeholder and so on. **Put it in the `resources/assets/mod_id/models/block/` folder.** + +### Custom Model {#custom-model} + +Another thing we will need is an instance of the `Model` class. It will represent the actual [parent block model](#parent-block-model) inside our mod. + +@[code lang=java transcludeWith=:::datagen-model-custom:model](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +The `block()` method creates a new `Model`, pointing to the `vertical_slab.json` file inside the `resources/assets/mod_id/models/block/` folder. +The `TextureKey`s represent the "placeholders" (`#bottom`, `#top`, ...) as an Object. + +### Using Texture Map {#using-texture-map} + +What does `TextureMap` do? It actually provides the Identifiers that point to the textures. It technically behaves like a normal map - you associate a `TextureKey` (Key) with an `Identifier` (Value). + +You can either use the vanilla ones, like `TextureMap.all()`(which associates all TextureKeys with the same Identifier), or create a new one, by creating a new instance and then using `.put()` to associate keys with values. + +::: tip +`TextureMap.all()` associates all TextureKeys with the same Identifier, no matter how many of them there are! +::: + +Since we want to use the Oak Log textures, but have the ``BOTTOM``, ``TOP`` and ``SIDE`` ``TextureKey``s, we need to create a new one. + +@[code lang=java transcludeWith=:::datagen-model-custom:texture-map](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +The ``bottom`` and ``top`` faces will use `oak_log_top.png`, the sides will use `oak_log.png`. + +::: warning +All `TextureKey`s in the TextureMap **have to** match all `TextureKey`s in your parent block model! +::: + +### Custom `BlockStateSupplier` Method {#custom-supplier-method} + +The `BlockStateSupplier` contains all blockstate variants, their rotation, and other options like uvlock. + +@[code lang=java transcludeWith=:::datagen-model-custom:supplier](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +First, we create a new `VariantsBlockStateSupplier` using `VariantsBlockStateSupplier.create()`. +Then we create a new `BlockStateVariantMap` that contains parameters for all variants of the block, in this case `FACING` and `SINGLE`, and pass it into the `VariantsBlockStateSupplier`. +Specify which model and which transformations (uvlock, rotation) is used when using `.register()`. +For example: + +- On the first line, the block is facing north, and is single => we use the model with no rotation. +- On the fourth line, the block is facing west, and is single => we rotate the model on the Y axis by 270°. +- On the sixth line, the block is facing east, but isn't single => it looks like a normal oak log => we don't have to rotate it. + +### Custom Datagen Method {#custom-datagen-method} + +The last step - creating an actual method you can call and that will generate the JSONs. +But what are the parameters for? + +1. `BlockStateModelGenerator generator`, the same one that got passed into `generateBlockStateModels`. +2. `Block vertSlabBlock` is the block to which we will generate the JSONs. +3. `Block fullBlock` - is the model used when the `SINGLE` property is false = the slab block looks like a full block. +4. `TextureMap textures` defines the actual textures the model uses. See the [Using Texture Map](#using-texture-map) chapter. + +@[code lang=java transcludeWith=:::datagen-model-custom:gen](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +First, we get the `Identifier` of the single slab model with `VERTICAL_SLAB.upload()`. Then we get the `Identifier` of the full block model with `ModelIds.getBlockModelId()`, and pass those two models into `createVerticalSlabBlockStates`. +The `BlockStateSupplier` gets passed into the `blockStateCollector`, so that the JSON files are actually generated. +Also, we create a model for the vertical slab item with `BlockStateModelGenerator.registerParentedItemModel()`. + +And that is all! Now all that's left to do is to call our method in our `ModelProvider`: + +@[code lang=java transcludeWith=:::datagen-model-custom:method-call](@/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java) + +## Sources and Links {#sources-and-links} + +You can view the example tests in [Fabric API](https://github.com/FabricMC/fabric/blob/1.21.4/fabric-data-generation-api-v1/src/) and this documentation's [Reference Mod](https://github.com/FabricMC/fabric-docs/tree/main/reference) for more information. + +You can also find more examples of using custom datagen methods by browsing mods' open-source code, for example [Vanilla+ Blocks](https://github.com/Fellteros/vanillablocksplus) and [Vanilla+ Verticals](https://github.com/Fellteros/vanillavsplus) by Fellteros. diff --git a/public/assets/develop/data-generation/block-model/pipe_block.png b/public/assets/develop/data-generation/block-model/pipe_block.png new file mode 100644 index 000000000..12d43aaf6 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/pipe_block.png differ diff --git a/public/assets/develop/data-generation/block-model/pipe_block_textures.zip b/public/assets/develop/data-generation/block-model/pipe_block_textures.zip new file mode 100644 index 000000000..6e3638f5c Binary files /dev/null and b/public/assets/develop/data-generation/block-model/pipe_block_textures.zip differ diff --git a/public/assets/develop/data-generation/block-model/pipe_block_textures_big.png b/public/assets/develop/data-generation/block-model/pipe_block_textures_big.png new file mode 100644 index 000000000..61f2391ef Binary files /dev/null and b/public/assets/develop/data-generation/block-model/pipe_block_textures_big.png differ diff --git a/public/assets/develop/data-generation/block-model/pipe_block_top.png b/public/assets/develop/data-generation/block-model/pipe_block_top.png new file mode 100644 index 000000000..2c6dbf3fc Binary files /dev/null and b/public/assets/develop/data-generation/block-model/pipe_block_top.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_block.png b/public/assets/develop/data-generation/block-model/ruby_block.png new file mode 100644 index 000000000..75c79bc31 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_block.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_block_big.png b/public/assets/develop/data-generation/block-model/ruby_block_big.png new file mode 100644 index 000000000..10b7c06e6 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_block_big.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_door.png b/public/assets/develop/data-generation/block-model/ruby_door.png new file mode 100644 index 000000000..b841cb71e Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_door.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_door_bottom.png b/public/assets/develop/data-generation/block-model/ruby_door_bottom.png new file mode 100644 index 000000000..624b156c5 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_door_bottom.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_door_top.png b/public/assets/develop/data-generation/block-model/ruby_door_top.png new file mode 100644 index 000000000..df504e3e7 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_door_top.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_big.png b/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_big.png new file mode 100644 index 000000000..18802ad1b Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_big.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_textures.zip b/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_textures.zip new file mode 100644 index 000000000..303469bf0 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_door_trapdoor_textures.zip differ diff --git a/public/assets/develop/data-generation/block-model/ruby_trapdoor.png b/public/assets/develop/data-generation/block-model/ruby_trapdoor.png new file mode 100644 index 000000000..75c79bc31 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_trapdoor.png differ diff --git a/public/assets/develop/data-generation/block-model/ruby_trapdoor_big.png b/public/assets/develop/data-generation/block-model/ruby_trapdoor_big.png new file mode 100644 index 000000000..75c79bc31 Binary files /dev/null and b/public/assets/develop/data-generation/block-model/ruby_trapdoor_big.png differ diff --git a/public/assets/develop/data-generation/block-model/steel_block.png b/public/assets/develop/data-generation/block-model/steel_block.png new file mode 100644 index 000000000..2a5f6549b Binary files /dev/null and b/public/assets/develop/data-generation/block-model/steel_block.png differ diff --git a/public/assets/develop/data-generation/block-model/steel_block_big.png b/public/assets/develop/data-generation/block-model/steel_block_big.png new file mode 100644 index 000000000..2a8c68d8f Binary files /dev/null and b/public/assets/develop/data-generation/block-model/steel_block_big.png differ diff --git a/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java index d92bb3c3f..a43fa1f3e 100644 --- a/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java +++ b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceDataGenerator.java @@ -38,6 +38,8 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { pack.addProvider(FabricDocsReferenceInternalModelProvider::new); + pack.addProvider(FabricDocsReferenceModelProvider::new); + // :::datagen-setup:generator } diff --git a/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceEnglishLangProvider.java b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceEnglishLangProvider.java index 96c72ffb6..f3753e6a0 100644 --- a/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceEnglishLangProvider.java +++ b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceEnglishLangProvider.java @@ -57,6 +57,16 @@ public void generateTranslations(RegistryWrapper.WrapperLookup wrapperLookup, Tr translationBuilder.add(ModBlocks.COUNTER_BLOCK.asItem(), "Counter Block"); translationBuilder.add(ModBlocks.PRISMARINE_LAMP.asItem(), "Prismarine Lamp"); translationBuilder.add(ModBlocks.ENGINE_BLOCK.asItem(), "Engine Block"); + + translationBuilder.add(ModBlocks.STEEL_BLOCK, "Steel Block"); + translationBuilder.add(ModBlocks.PIPE_BLOCK, "Pipe Block"); + translationBuilder.add(ModBlocks.RUBY_BLOCK, "Ruby Block"); + translationBuilder.add(ModBlocks.RUBY_STAIRS, "Ruby Stairs"); + translationBuilder.add(ModBlocks.RUBY_SLAB, "Ruby Slab"); + translationBuilder.add(ModBlocks.RUBY_FENCE, "Ruby Fence"); + translationBuilder.add(ModBlocks.RUBY_DOOR, "Ruby Door"); + translationBuilder.add(ModBlocks.RUBY_TRAPDOOR, "Ruby Trapdoor"); + translationBuilder.add(ModBlocks.VERTICAL_OAK_LOG_SLAB, "Vertical Oak Log Slab"); // :::datagen-translations:provider } } diff --git a/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java new file mode 100644 index 000000000..ef9bf23ce --- /dev/null +++ b/reference/latest/src/client/java/com/example/docs/datagen/FabricDocsReferenceModelProvider.java @@ -0,0 +1,157 @@ +package com.example.docs.datagen; + +import java.util.Optional; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.client.data.BlockStateModelGenerator; +import net.minecraft.client.data.BlockStateSupplier; +import net.minecraft.client.data.BlockStateVariant; +import net.minecraft.client.data.BlockStateVariantMap; +import net.minecraft.client.data.ItemModelGenerator; +import net.minecraft.client.data.Model; +import net.minecraft.client.data.ModelIds; +import net.minecraft.client.data.TextureKey; +import net.minecraft.client.data.TextureMap; +import net.minecraft.client.data.TexturedModel; +import net.minecraft.client.data.VariantSetting; +import net.minecraft.client.data.VariantSettings; +import net.minecraft.client.data.VariantsBlockStateSupplier; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Direction; + +import net.fabricmc.fabric.api.client.datagen.v1.provider.FabricModelProvider; +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; + +import com.example.docs.FabricDocsReference; +import com.example.docs.block.ModBlocks; +import com.example.docs.block.custom.VerticalSlabBlock; + +// :::datagen-model:provider +public class FabricDocsReferenceModelProvider extends FabricModelProvider { + public FabricDocsReferenceModelProvider(FabricDataOutput output) { + super(output); + } + + @Override + public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { + // :::datagen-model:provider + + // :::datagen-model:cube-all + blockStateModelGenerator.registerSimpleCubeAll(ModBlocks.STEEL_BLOCK); + // :::datagen-model:cube-all + + // :::datagen-model:cube-top-for-ends + blockStateModelGenerator.registerSingleton(ModBlocks.PIPE_BLOCK, TexturedModel.END_FOR_TOP_CUBE_COLUMN); + // :::datagen-model:cube-top-for-ends + + // :::datagen-model:block-texture-pool-normal + blockStateModelGenerator.registerCubeAllModelTexturePool(ModBlocks.RUBY_BLOCK) + .stairs(ModBlocks.RUBY_STAIRS) + .slab(ModBlocks.RUBY_SLAB) + .fence(ModBlocks.RUBY_FENCE); + // :::datagen-model:block-texture-pool-normal + + // :::datagen-model:door-and-trapdoor + blockStateModelGenerator.registerDoor(ModBlocks.RUBY_DOOR); + blockStateModelGenerator.registerTrapdoor(ModBlocks.RUBY_TRAPDOOR); + // blockStateModelGenerator.registerOrientableTrapdoor(ModBlocks.RUBY_TRAPDOOR); + // :::datagen-model:door-and-trapdoor + + // :::datagen-model-custom:method-call + CustomBlockStateModelGenerator.registerVerticalSlab( + blockStateModelGenerator, + ModBlocks.VERTICAL_OAK_LOG_SLAB, + Blocks.OAK_LOG, + CustomBlockStateModelGenerator.blockAndTopForEnds(Blocks.OAK_LOG) + ); + // :::datagen-model-custom:method-call + + // :::datagen-model:provider + } + + // :::datagen-model:provider + + // used just for examples, not for actual data generation + @SuppressWarnings("unused") + public void exampleBlockStateGeneration(BlockStateModelGenerator blockStateModelGenerator) { + // :::datagen-model:block-texture-pool-family + blockStateModelGenerator.registerCubeAllModelTexturePool(ModBlocks.RUBY_BLOCK).family(ModBlocks.RUBY_FAMILY); + // :::datagen-model:block-texture-pool-family + } + + // :::datagen-model:provider + + @Override + public void generateItemModels(ItemModelGenerator itemModelGenerator) { + // :::datagen-model:provider + + //TODO Since I have little experience with generating item models, I will leave this to someone more experienced (Fellteros) + + // :::datagen-model:provider + } + + // :::datagen-model:provider + + // Inner class containing all Objects needed for the custom datagen tutorial. + public static class CustomBlockStateModelGenerator { + // :::datagen-model-custom:model + public static final Model VERTICAL_SLAB = block("vertical_slab", TextureKey.BOTTOM, TextureKey.TOP, TextureKey.SIDE); + + //helper method for creating Models + private static Model block(String parent, TextureKey... requiredTextureKeys) { + return new Model(Optional.of(Identifier.of(FabricDocsReference.MOD_ID, "block/" + parent)), Optional.empty(), requiredTextureKeys); + } + + //helper method for creating Models with variants + private static Model block(String parent, String variant, TextureKey... requiredTextureKeys) { + return new Model(Optional.of(Identifier.of(FabricDocsReference.MOD_ID, "block/" + parent)), Optional.of(variant), requiredTextureKeys); + } + + // :::datagen-model-custom:model + + // :::datagen-model-custom:texture-map + public static TextureMap blockAndTopForEnds(Block block) { + return new TextureMap() + .put(TextureKey.TOP, ModelIds.getBlockSubModelId(block, "_top")) + .put(TextureKey.BOTTOM, ModelIds.getBlockSubModelId(block, "_top")) + .put(TextureKey.SIDE, ModelIds.getBlockModelId(block)); + } + + // :::datagen-model-custom:texture-map + + // :::datagen-model-custom:supplier + private static BlockStateSupplier createVerticalSlabBlockStates(Block vertSlabBlock, Identifier vertSlabId, Identifier fullBlockId) { + VariantSetting uvlock = VariantSettings.UVLOCK; + VariantSetting yRot = VariantSettings.Y; + return VariantsBlockStateSupplier.create(vertSlabBlock).coordinate(BlockStateVariantMap.create(VerticalSlabBlock.FACING, VerticalSlabBlock.SINGLE) + .register(Direction.NORTH, true, BlockStateVariant.create().put(VariantSettings.MODEL, vertSlabId).put(uvlock, true)) + .register(Direction.EAST, true, BlockStateVariant.create().put(VariantSettings.MODEL, vertSlabId).put(uvlock, true).put(yRot, VariantSettings.Rotation.R90)) + .register(Direction.SOUTH, true, BlockStateVariant.create().put(VariantSettings.MODEL, vertSlabId).put(uvlock, true).put(yRot, VariantSettings.Rotation.R180)) + .register(Direction.WEST, true, BlockStateVariant.create().put(VariantSettings.MODEL, vertSlabId).put(uvlock, true).put(yRot, VariantSettings.Rotation.R270)) + .register(Direction.NORTH, false, BlockStateVariant.create().put(VariantSettings.MODEL, fullBlockId).put(uvlock, true)) + .register(Direction.EAST, false, BlockStateVariant.create().put(VariantSettings.MODEL, fullBlockId).put(uvlock, true)) + .register(Direction.SOUTH, false, BlockStateVariant.create().put(VariantSettings.MODEL, fullBlockId).put(uvlock, true)) + .register(Direction.WEST, false, BlockStateVariant.create().put(VariantSettings.MODEL, fullBlockId).put(uvlock, true))); + } + + // :::datagen-model-custom:supplier + + // :::datagen-model-custom:gen + public static void registerVerticalSlab(BlockStateModelGenerator generator, Block vertSlabBlock, Block fullBlock, TextureMap textures) { + Identifier slabModel = VERTICAL_SLAB.upload(vertSlabBlock, textures, generator.modelCollector); + Identifier fullBlockModel = ModelIds.getBlockModelId(fullBlock); + generator.blockStateCollector.accept(createVerticalSlabBlockStates(vertSlabBlock, slabModel, fullBlockModel)); + generator.registerParentedItemModel(vertSlabBlock, slabModel); + } + + // :::datagen-model-custom:gen + } + + // :::datagen-model:provider + @Override + public String getName() { + return "FabricDocsReference Model Provider"; + } +} +// :::datagen-model:provider diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/pipe_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/pipe_block.json new file mode 100644 index 000000000..e7ad78017 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/pipe_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "fabric-docs-reference:block/pipe_block" + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_block.json new file mode 100644 index 000000000..71f5964d5 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "fabric-docs-reference:block/ruby_block" + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_door.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_door.json new file mode 100644 index 000000000..7134d5ea4 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_door.json @@ -0,0 +1,124 @@ +{ + "variants": { + "facing=east,half=lower,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left" + }, + "facing=east,half=lower,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left_open", + "y": 90 + }, + "facing=east,half=lower,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right" + }, + "facing=east,half=lower,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right_open", + "y": 270 + }, + "facing=east,half=upper,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_left" + }, + "facing=east,half=upper,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_left_open", + "y": 90 + }, + "facing=east,half=upper,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_right" + }, + "facing=east,half=upper,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_right_open", + "y": 270 + }, + "facing=north,half=lower,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left", + "y": 270 + }, + "facing=north,half=lower,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left_open" + }, + "facing=north,half=lower,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right", + "y": 270 + }, + "facing=north,half=lower,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right_open", + "y": 180 + }, + "facing=north,half=upper,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_left", + "y": 270 + }, + "facing=north,half=upper,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_left_open" + }, + "facing=north,half=upper,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_right", + "y": 270 + }, + "facing=north,half=upper,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_right_open", + "y": 180 + }, + "facing=south,half=lower,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left", + "y": 90 + }, + "facing=south,half=lower,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left_open", + "y": 180 + }, + "facing=south,half=lower,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right", + "y": 90 + }, + "facing=south,half=lower,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right_open" + }, + "facing=south,half=upper,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_left", + "y": 90 + }, + "facing=south,half=upper,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_left_open", + "y": 180 + }, + "facing=south,half=upper,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_right", + "y": 90 + }, + "facing=south,half=upper,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_right_open" + }, + "facing=west,half=lower,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left", + "y": 180 + }, + "facing=west,half=lower,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_left_open", + "y": 270 + }, + "facing=west,half=lower,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right", + "y": 180 + }, + "facing=west,half=lower,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_bottom_right_open", + "y": 90 + }, + "facing=west,half=upper,hinge=left,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_left", + "y": 180 + }, + "facing=west,half=upper,hinge=left,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_left_open", + "y": 270 + }, + "facing=west,half=upper,hinge=right,open=false": { + "model": "fabric-docs-reference:block/ruby_door_top_right", + "y": 180 + }, + "facing=west,half=upper,hinge=right,open=true": { + "model": "fabric-docs-reference:block/ruby_door_top_right_open", + "y": 90 + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_fence.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_fence.json new file mode 100644 index 000000000..def805c17 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_fence.json @@ -0,0 +1,48 @@ +{ + "multipart": [ + { + "apply": { + "model": "fabric-docs-reference:block/ruby_fence_post" + } + }, + { + "apply": { + "model": "fabric-docs-reference:block/ruby_fence_side", + "uvlock": true + }, + "when": { + "north": "true" + } + }, + { + "apply": { + "model": "fabric-docs-reference:block/ruby_fence_side", + "uvlock": true, + "y": 90 + }, + "when": { + "east": "true" + } + }, + { + "apply": { + "model": "fabric-docs-reference:block/ruby_fence_side", + "uvlock": true, + "y": 180 + }, + "when": { + "south": "true" + } + }, + { + "apply": { + "model": "fabric-docs-reference:block/ruby_fence_side", + "uvlock": true, + "y": 270 + }, + "when": { + "west": "true" + } + } + ] +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_slab.json new file mode 100644 index 000000000..d8016c008 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_slab.json @@ -0,0 +1,13 @@ +{ + "variants": { + "type=bottom": { + "model": "fabric-docs-reference:block/ruby_slab" + }, + "type=double": { + "model": "fabric-docs-reference:block/ruby_block" + }, + "type=top": { + "model": "fabric-docs-reference:block/ruby_slab_top" + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_stairs.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_stairs.json new file mode 100644 index 000000000..64c956105 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_stairs.json @@ -0,0 +1,209 @@ +{ + "variants": { + "facing=east,half=bottom,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner" + }, + "facing=east,half=bottom,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=east,half=bottom,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer" + }, + "facing=east,half=bottom,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs" + }, + "facing=east,half=top,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=east,half=top,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=east,half=top,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "x": 180 + }, + "facing=north,half=bottom,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=north,half=bottom,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 270 + }, + "facing=north,half=bottom,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "y": 270 + }, + "facing=north,half=top,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=north,half=top,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180 + }, + "facing=north,half=top,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=south,half=bottom,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner" + }, + "facing=south,half=bottom,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer" + }, + "facing=south,half=bottom,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=south,half=bottom,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "y": 90 + }, + "facing=south,half=top,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=south,half=top,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=south,half=top,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "x": 180, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 90 + }, + "facing=west,half=bottom,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "y": 180 + }, + "facing=west,half=bottom,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "y": 180 + }, + "facing=west,half=top,shape=inner_left": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=inner_right": { + "model": "fabric-docs-reference:block/ruby_stairs_inner", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=outer_left": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 180 + }, + "facing=west,half=top,shape=outer_right": { + "model": "fabric-docs-reference:block/ruby_stairs_outer", + "uvlock": true, + "x": 180, + "y": 270 + }, + "facing=west,half=top,shape=straight": { + "model": "fabric-docs-reference:block/ruby_stairs", + "uvlock": true, + "x": 180, + "y": 180 + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_trapdoor.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_trapdoor.json new file mode 100644 index 000000000..d183fe96b --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/ruby_trapdoor.json @@ -0,0 +1,58 @@ +{ + "variants": { + "facing=east,half=bottom,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_bottom" + }, + "facing=east,half=bottom,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 90 + }, + "facing=east,half=top,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_top" + }, + "facing=east,half=top,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 90 + }, + "facing=north,half=bottom,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_bottom" + }, + "facing=north,half=bottom,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open" + }, + "facing=north,half=top,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_top" + }, + "facing=north,half=top,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open" + }, + "facing=south,half=bottom,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_bottom" + }, + "facing=south,half=bottom,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 180 + }, + "facing=south,half=top,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_top" + }, + "facing=south,half=top,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 180 + }, + "facing=west,half=bottom,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_bottom" + }, + "facing=west,half=bottom,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 270 + }, + "facing=west,half=top,open=false": { + "model": "fabric-docs-reference:block/ruby_trapdoor_top" + }, + "facing=west,half=top,open=true": { + "model": "fabric-docs-reference:block/ruby_trapdoor_open", + "y": 270 + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/steel_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/steel_block.json new file mode 100644 index 000000000..13013a2ea --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/steel_block.json @@ -0,0 +1,7 @@ +{ + "variants": { + "": { + "model": "fabric-docs-reference:block/steel_block" + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/vertical_oak_log_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/vertical_oak_log_slab.json new file mode 100644 index 000000000..d8593048d --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/blockstates/vertical_oak_log_slab.json @@ -0,0 +1,39 @@ +{ + "variants": { + "facing=east,single=false": { + "model": "minecraft:block/oak_log", + "uvlock": true + }, + "facing=east,single=true": { + "model": "fabric-docs-reference:block/vertical_oak_log_slab", + "uvlock": true, + "y": 90 + }, + "facing=north,single=false": { + "model": "minecraft:block/oak_log", + "uvlock": true + }, + "facing=north,single=true": { + "model": "fabric-docs-reference:block/vertical_oak_log_slab", + "uvlock": true + }, + "facing=south,single=false": { + "model": "minecraft:block/oak_log", + "uvlock": true + }, + "facing=south,single=true": { + "model": "fabric-docs-reference:block/vertical_oak_log_slab", + "uvlock": true, + "y": 180 + }, + "facing=west,single=false": { + "model": "minecraft:block/oak_log", + "uvlock": true + }, + "facing=west,single=true": { + "model": "fabric-docs-reference:block/vertical_oak_log_slab", + "uvlock": true, + "y": 270 + } + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/pipe_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/pipe_block.json new file mode 100644 index 000000000..ac16ef413 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/pipe_block.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/pipe_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_block.json new file mode 100644 index 000000000..2d7e26edb --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_block.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_door.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_door.json new file mode 100644 index 000000000..07d2240a9 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_door.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:item/ruby_door" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_fence.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_fence.json new file mode 100644 index 000000000..aee82d9ad --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_fence.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/ruby_fence_inventory" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_slab.json new file mode 100644 index 000000000..bd003b663 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_slab.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/ruby_slab" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_stairs.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_stairs.json new file mode 100644 index 000000000..8918ad9b2 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_stairs.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/ruby_stairs" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_trapdoor.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_trapdoor.json new file mode 100644 index 000000000..620b00ddb --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/ruby_trapdoor.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/ruby_trapdoor_bottom" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/steel_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/steel_block.json new file mode 100644 index 000000000..f369f13fc --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/steel_block.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/steel_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/items/vertical_oak_log_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/vertical_oak_log_slab.json new file mode 100644 index 000000000..22a242a3b --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/items/vertical_oak_log_slab.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "fabric-docs-reference:block/vertical_oak_log_slab" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/lang/en_us.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/lang/en_us.json index 46e48bef6..dd0a7e484 100644 --- a/reference/latest/src/main/generated/assets/fabric-docs-reference/lang/en_us.json +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/lang/en_us.json @@ -3,7 +3,16 @@ "block.fabric-docs-reference.condensed_oak_log": "Condensed Oak Log", "block.fabric-docs-reference.counter_block": "Counter Block", "block.fabric-docs-reference.engine": "Engine Block", + "block.fabric-docs-reference.pipe_block": "Pipe Block", "block.fabric-docs-reference.prismarine_lamp": "Prismarine Lamp", + "block.fabric-docs-reference.ruby_block": "Ruby Block", + "block.fabric-docs-reference.ruby_door": "Ruby Door", + "block.fabric-docs-reference.ruby_fence": "Ruby Fence", + "block.fabric-docs-reference.ruby_slab": "Ruby Slab", + "block.fabric-docs-reference.ruby_stairs": "Ruby Stairs", + "block.fabric-docs-reference.ruby_trapdoor": "Ruby Trapdoor", + "block.fabric-docs-reference.steel_block": "Steel Block", + "block.fabric-docs-reference.vertical_oak_log_slab": "Vertical Oak Log Slab", "death.attack.tater": "%1$s died from Tater damage!", "effect.fabric-docs-reference.tater": "Tater", "enchantment.fabric-docs-reference.thundering": "Thundering", diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/pipe_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/pipe_block.json new file mode 100644 index 000000000..5623b345d --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/pipe_block.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/cube_column", + "textures": { + "end": "fabric-docs-reference:block/pipe_block_top", + "side": "fabric-docs-reference:block/pipe_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_block.json new file mode 100644 index 000000000..fafc5cf4c --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left.json new file mode 100644 index 000000000..14eab585c --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left_open.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left_open.json new file mode 100644 index 000000000..47b9dbbc0 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_left_open", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right.json new file mode 100644 index 000000000..f16646302 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right_open.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right_open.json new file mode 100644 index 000000000..04c7c3dad --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_bottom_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_bottom_right_open", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left.json new file mode 100644 index 000000000..19ff9c361 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left_open.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left_open.json new file mode 100644 index 000000000..1027e14b4 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_left_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_left_open", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right.json new file mode 100644 index 000000000..6c2127114 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right_open.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right_open.json new file mode 100644 index 000000000..b950fb298 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_door_top_right_open.json @@ -0,0 +1,7 @@ +{ + "parent": "minecraft:block/door_top_right_open", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_door_bottom", + "top": "fabric-docs-reference:block/ruby_door_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_inventory.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_inventory.json new file mode 100644 index 000000000..e48eedc6b --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_inventory", + "textures": { + "texture": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_post.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_post.json new file mode 100644 index 000000000..c12a70ec2 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_post.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_post", + "textures": { + "texture": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_side.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_side.json new file mode 100644 index 000000000..42f4d0e69 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_fence_side.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/fence_side", + "textures": { + "texture": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab.json new file mode 100644 index 000000000..9fb9d213e --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_block", + "side": "fabric-docs-reference:block/ruby_block", + "top": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab_top.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab_top.json new file mode 100644 index 000000000..f1d1c9591 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_slab_top.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/slab_top", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_block", + "side": "fabric-docs-reference:block/ruby_block", + "top": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs.json new file mode 100644 index 000000000..556b498d3 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/stairs", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_block", + "side": "fabric-docs-reference:block/ruby_block", + "top": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_inner.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_inner.json new file mode 100644 index 000000000..5c187826a --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_inner.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/inner_stairs", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_block", + "side": "fabric-docs-reference:block/ruby_block", + "top": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_outer.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_outer.json new file mode 100644 index 000000000..9212dfeba --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_stairs_outer.json @@ -0,0 +1,8 @@ +{ + "parent": "minecraft:block/outer_stairs", + "textures": { + "bottom": "fabric-docs-reference:block/ruby_block", + "side": "fabric-docs-reference:block/ruby_block", + "top": "fabric-docs-reference:block/ruby_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_bottom.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_bottom.json new file mode 100644 index 000000000..7c184bec6 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_bottom.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_trapdoor_bottom", + "textures": { + "texture": "fabric-docs-reference:block/ruby_trapdoor" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_open.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_open.json new file mode 100644 index 000000000..a6aa488d3 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_open.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_trapdoor_open", + "textures": { + "texture": "fabric-docs-reference:block/ruby_trapdoor" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_top.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_top.json new file mode 100644 index 000000000..295dddbf0 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/ruby_trapdoor_top.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/template_trapdoor_top", + "textures": { + "texture": "fabric-docs-reference:block/ruby_trapdoor" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/steel_block.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/steel_block.json new file mode 100644 index 000000000..4c8b1a76e --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/steel_block.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:block/cube_all", + "textures": { + "all": "fabric-docs-reference:block/steel_block" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/vertical_oak_log_slab.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/vertical_oak_log_slab.json new file mode 100644 index 000000000..021f64564 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/block/vertical_oak_log_slab.json @@ -0,0 +1,8 @@ +{ + "parent": "fabric-docs-reference:block/vertical_slab", + "textures": { + "bottom": "minecraft:block/oak_log_top", + "side": "minecraft:block/oak_log", + "top": "minecraft:block/oak_log_top" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/generated/assets/fabric-docs-reference/models/item/ruby_door.json b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/item/ruby_door.json new file mode 100644 index 000000000..9ed308b23 --- /dev/null +++ b/reference/latest/src/main/generated/assets/fabric-docs-reference/models/item/ruby_door.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/generated", + "textures": { + "layer0": "fabric-docs-reference:item/ruby_door" + } +} \ No newline at end of file diff --git a/reference/latest/src/main/java/com/example/docs/block/ModBlocks.java b/reference/latest/src/main/java/com/example/docs/block/ModBlocks.java index d503a9bb8..50e2b5f42 100644 --- a/reference/latest/src/main/java/com/example/docs/block/ModBlocks.java +++ b/reference/latest/src/main/java/com/example/docs/block/ModBlocks.java @@ -1,8 +1,19 @@ package com.example.docs.block; +import java.util.function.Function; + +import org.jetbrains.annotations.NotNull; + import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; +import net.minecraft.block.BlockSetType; +import net.minecraft.block.DoorBlock; +import net.minecraft.block.FenceBlock; import net.minecraft.block.PillarBlock; +import net.minecraft.block.SlabBlock; +import net.minecraft.block.StairsBlock; +import net.minecraft.block.TrapdoorBlock; +import net.minecraft.data.family.BlockFamily; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.registry.Registries; @@ -18,6 +29,7 @@ import com.example.docs.block.custom.CounterBlock; import com.example.docs.block.custom.EngineBlock; import com.example.docs.block.custom.PrismarineLampBlock; +import com.example.docs.block.custom.VerticalSlabBlock; import com.example.docs.item.ModItems; // :::1 @@ -84,6 +96,45 @@ public class ModBlocks { ); // :::5 + public static final Block STEEL_BLOCK = registerBlock( + "steel_block", PillarBlock::new, AbstractBlock.Settings.create() + ); + public static final Block PIPE_BLOCK = registerBlock( + "pipe_block", Block::new, AbstractBlock.Settings.create() + ); + + public static final Block RUBY_BLOCK = registerBlock( + "ruby_block", Block::new, AbstractBlock.Settings.create() + ); + public static final Block RUBY_STAIRS = registerBlock( + "ruby_stairs", settings -> new StairsBlock(RUBY_BLOCK.getDefaultState(), settings), AbstractBlock.Settings.create() + ); + public static final Block RUBY_SLAB = registerBlock( + "ruby_slab", SlabBlock::new, AbstractBlock.Settings.create() + ); + public static final Block RUBY_FENCE = registerBlock( + "ruby_fence", FenceBlock::new, AbstractBlock.Settings.create() + ); + + public static final Block RUBY_DOOR = registerBlock( + "ruby_door", settings -> new DoorBlock(BlockSetType.STONE, settings), AbstractBlock.Settings.create() + ); + public static final Block RUBY_TRAPDOOR = registerBlock( + "ruby_trapdoor", settings -> new TrapdoorBlock(BlockSetType.STONE, settings), AbstractBlock.Settings.create() + ); + + public static final Block VERTICAL_OAK_LOG_SLAB = registerBlock( + "vertical_oak_log_slab", VerticalSlabBlock::new, AbstractBlock.Settings.create()); + + // :::datagen-model:family-declaration + public static final BlockFamily RUBY_FAMILY = + new BlockFamily.Builder(ModBlocks.RUBY_BLOCK) + .stairs(ModBlocks.RUBY_STAIRS) + .slab(ModBlocks.RUBY_SLAB) + .fence(ModBlocks.RUBY_FENCE) + .build(); + // :::datagen-model:family-declaration + // :::1 public static Block register(Block block, RegistryKey blockKey, boolean shouldRegisterItem) { // Sometimes, you may not want to register an item for the block. @@ -101,6 +152,27 @@ public static Block register(Block block, RegistryKey blockKey, boolean s } // :::1 + + /** Helper methods for registering blocks (Fellteros).
+ * Block would look like this: + *
+	 *     public static final Block TEST = registerBlock("test", Block::new, AbstractBlock.Settings.create());
+	 * 
+ * */ + private static Block registerBlock(String name, @NotNull Function function, AbstractBlock.@NotNull Settings settings) { + Block block = function.apply(settings.registryKey(keyOfBlock(name))); + Registry.register(Registries.ITEM, Identifier.of(FabricDocsReference.MOD_ID, name), new BlockItem(block, new Item.Settings().useBlockPrefixedTranslationKey().registryKey(keyOfItem(name)))); + return Registry.register(Registries.BLOCK, keyOfBlock(name), block); + } + + private static RegistryKey keyOfItem(String name) { + return RegistryKey.of(RegistryKeys.ITEM, Identifier.of(FabricDocsReference.MOD_ID, name)); + } + + private static RegistryKey keyOfBlock(String name) { + return RegistryKey.of(RegistryKeys.BLOCK, Identifier.of(FabricDocsReference.MOD_ID, name)); + } + public static void initialize() { setupItemGroups(); } @@ -117,6 +189,13 @@ public static void setupItemGroups() { itemGroup.add(ModBlocks.PRISMARINE_LAMP.asItem()); itemGroup.add(ModBlocks.COUNTER_BLOCK.asItem()); itemGroup.add(ModBlocks.ENGINE_BLOCK.asItem()); + itemGroup.add(RUBY_BLOCK); + itemGroup.add(RUBY_STAIRS); + itemGroup.add(RUBY_SLAB); + itemGroup.add(RUBY_FENCE); + itemGroup.add(RUBY_DOOR); + itemGroup.add(RUBY_TRAPDOOR); + itemGroup.add(VERTICAL_OAK_LOG_SLAB); }); } diff --git a/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java b/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java new file mode 100644 index 000000000..f980dc142 --- /dev/null +++ b/reference/latest/src/main/java/com/example/docs/block/custom/VerticalSlabBlock.java @@ -0,0 +1,131 @@ +package com.example.docs.block.custom; + +import java.util.Objects; + +import org.jetbrains.annotations.Nullable; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.ShapeContext; +import net.minecraft.item.ItemPlacementContext; +import net.minecraft.state.StateManager; +import net.minecraft.state.property.BooleanProperty; +import net.minecraft.state.property.EnumProperty; +import net.minecraft.state.property.Properties; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.shape.VoxelShape; +import net.minecraft.util.shape.VoxelShapes; +import net.minecraft.world.BlockView; + +// :::datagen-model-custom:constructor +public class VerticalSlabBlock extends Block { + // :::datagen-model-custom:constructor + + // :::datagen-model-custom:properties + public static final BooleanProperty SINGLE = BooleanProperty.of("single"); + public static final EnumProperty FACING = Properties.HORIZONTAL_FACING; + // :::datagen-model-custom:properties + // :::datagen-model-custom:voxels + public static final VoxelShape NORTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 16.0, 16.0, 8.0); + public static final VoxelShape SOUTH_SHAPE = Block.createCuboidShape(0.0, 0.0, 8.0, 16.0, 16.0, 16.0); + public static final VoxelShape WEST_SHAPE = Block.createCuboidShape(0.0, 0.0, 0.0, 8.0, 16.0, 16.0); + public static final VoxelShape EAST_SHAPE = Block.createCuboidShape(8.0, 0.0, 0.0, 16.0, 16.0, 16.0); + // :::datagen-model-custom:voxels + + // :::datagen-model-custom:constructor + public VerticalSlabBlock(Settings settings) { + super(settings); + } + + // :::datagen-model-custom:constructor + + // :::datagen-model-custom:collision + @Override + protected VoxelShape getSidesShape(BlockState state, BlockView world, BlockPos pos) { + boolean type = state.get(SINGLE); + Direction direction = state.get(FACING); + VoxelShape voxelShape; + + if (type) { + switch (direction) { + case WEST -> voxelShape = WEST_SHAPE.asCuboid(); + case EAST -> voxelShape = EAST_SHAPE.asCuboid(); + case SOUTH -> voxelShape = SOUTH_SHAPE.asCuboid(); + case NORTH -> voxelShape = NORTH_SHAPE.asCuboid(); + default -> throw new MatchException(null, null); + } + + return voxelShape; + } else { + return VoxelShapes.fullCube(); + } + } + + @Override + protected VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return this.getSidesShape(state, world, pos); + } + + @Override + protected VoxelShape getCollisionShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { + return this.getSidesShape(state, world, pos); + } + + // :::datagen-model-custom:collision + + // :::datagen-model-custom:replace + @Override + protected boolean canReplace(BlockState state, ItemPlacementContext context) { + Direction direction = state.get(FACING); + + if (context.getStack().isOf(this.asItem()) && state.get(SINGLE)) { + if (context.canReplaceExisting()) { + return context.getSide().getOpposite() == direction; + } + } + + return false; + } + + // :::datagen-model-custom:replace + + // :::datagen-model-custom:placement + @Override + @Nullable + public BlockState getPlacementState(ItemPlacementContext ctx) { + BlockPos pos = ctx.getBlockPos(); + Direction direction = ctx.getHorizontalPlayerFacing(); + BlockState state = ctx.getWorld().getBlockState(pos); + BlockState state2 = Objects.requireNonNull(super.getPlacementState(ctx)); + + if (state.isOf(this) && state.get(FACING) == ctx.getSide().getOpposite()) { + return state.isOf(this) ? state2.with(SINGLE, false) : super.getPlacementState(ctx); + } + + if (direction == Direction.NORTH && ctx.getHitPos().z - pos.getZ() > 0.5) { + return state2.with(FACING, Direction.SOUTH).with(SINGLE, true); + } else if (direction == Direction.SOUTH && ctx.getHitPos().z - pos.getZ() < 0.5) { + return state2.with(FACING, Direction.NORTH).with(SINGLE, true); + } else if (direction == Direction.WEST && ctx.getHitPos().x - pos.getX() > 0.5) { + return state2.with(FACING, Direction.EAST).with(SINGLE, true); + } else if (direction == Direction.EAST && ctx.getHitPos().x - pos.getX() < 0.5) { + return state2.with(FACING, Direction.WEST).with(SINGLE, true); + } else { + return state2.with(FACING, direction); + } + } + + // :::datagen-model-custom:placement + + // :::datagen-model-custom:append + @Override + protected void appendProperties(StateManager.Builder builder) { + builder.add(SINGLE, FACING); + } + + // :::datagen-model-custom:append + + // :::datagen-model-custom:constructor +} +// :::datagen-model-custom:constructor diff --git a/reference/latest/src/main/java/com/example/docs/item/ModItems.java b/reference/latest/src/main/java/com/example/docs/item/ModItems.java index 0a87c31d7..766f215ce 100644 --- a/reference/latest/src/main/java/com/example/docs/item/ModItems.java +++ b/reference/latest/src/main/java/com/example/docs/item/ModItems.java @@ -108,7 +108,6 @@ public class ModItems { SUSPICIOUS_SUBSTANCE_KEY ); // :::2 - // :::1 public static Item register(Item item, RegistryKey registryKey) { // Register the item. diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/models/block/vertical_slab.json b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/block/vertical_slab.json new file mode 100644 index 000000000..dc98651c3 --- /dev/null +++ b/reference/latest/src/main/resources/assets/fabric-docs-reference/models/block/vertical_slab.json @@ -0,0 +1,174 @@ +{ + "parent": "minecraft:block/block", + "textures": { + "particle": "#side" + }, + "display": { + "gui": { + "rotation": [ + 30, + -135, + 0 + ], + "translation": [ + -1.5, + 0.75, + 0 + ], + "scale": [ + 0.625, + 0.625, + 0.625 + ] + }, + "firstperson_righthand": { + "rotation": [ + 0, + -45, + 0 + ], + "translation": [ + 0, + 2, + 0 + ], + "scale": [ + 0.375, + 0.375, + 0.375 + ] + }, + "firstperson_lefthand": { + "rotation": [ + 0, + 315, + 0 + ], + "translation": [ + 0, + 2, + 0 + ], + "scale": [ + 0.375, + 0.375, + 0.375 + ] + }, + "thirdperson_righthand": { + "rotation": [ + 75, + -45, + 0 + ], + "translation": [ + 0, + 0, + 2 + ], + "scale": [ + 0.375, + 0.375, + 0.375 + ] + }, + "thirdperson_lefthand": { + "rotation": [ + 75, + 315, + 0 + ], + "translation": [ + 0, + 0, + 2 + ], + "scale": [ + 0.375, + 0.375, + 0.375 + ] + } + }, + "elements": [ + { + "from": [ + 0, + 0, + 0 + ], + "to": [ + 16, + 16, + 8 + ], + "faces": { + "down": { + "uv": [ + 0, + 8, + 16, + 16 + ], + "texture": "#bottom", + "cullface": "down", + "tintindex": 0 + }, + "up": { + "uv": [ + 0, + 0, + 16, + 8 + ], + "texture": "#top", + "cullface": "up", + "tintindex": 0 + }, + "north": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#side", + "cullface": "north", + "tintindex": 0 + }, + "south": { + "uv": [ + 0, + 0, + 16, + 16 + ], + "texture": "#side", + "tintindex": 0 + }, + "west": { + "uv": [ + 0, + 0, + 8, + 16 + ], + "texture": "#side", + "cullface": "west", + "tintindex": 0 + }, + "east": { + "uv": [ + 8, + 0, + 16, + 16 + ], + "texture": "#side", + "cullface": "east", + "tintindex": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block.png new file mode 100644 index 000000000..12d43aaf6 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block_top.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block_top.png new file mode 100644 index 000000000..2c6dbf3fc Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/pipe_block_top.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_block.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_block.png new file mode 100644 index 000000000..75c79bc31 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_block.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_bottom.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_bottom.png new file mode 100644 index 000000000..624b156c5 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_bottom.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_top.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_top.png new file mode 100644 index 000000000..df504e3e7 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_door_top.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_trapdoor.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_trapdoor.png new file mode 100644 index 000000000..75c79bc31 Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/ruby_trapdoor.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/steel_block.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/steel_block.png new file mode 100644 index 000000000..2a5f6549b Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/block/steel_block.png differ diff --git a/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/ruby_door.png b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/ruby_door.png new file mode 100644 index 000000000..b841cb71e Binary files /dev/null and b/reference/latest/src/main/resources/assets/fabric-docs-reference/textures/item/ruby_door.png differ diff --git a/sidebar_translations.json b/sidebar_translations.json index 23dd41fc7..9965a6e85 100644 --- a/sidebar_translations.json +++ b/sidebar_translations.json @@ -49,6 +49,7 @@ "develop.dataGeneration.advancements": "Advancement Generation", "develop.dataGeneration.recipes": "Recipe Generation", "develop.dataGeneration.lootTables": "Loot Table Generation", + "develop.dataGeneration.blockModels": "Block Model Generation", "develop.rendering": "Rendering", "develop.rendering.basicConcepts": "Basic Rendering Concepts", "develop.rendering.drawContext": "Using the Drawing Context",