Move cubes models & blockstates to datagen

This commit is contained in:
Andrew-71 2023-09-21 11:46:25 +03:00
parent 701158aedd
commit 608f8bafee
13 changed files with 178 additions and 1 deletions

View file

@ -4,6 +4,7 @@ package su.a71.new_soviet.datagen;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.data.client.ItemModelGenerator;
import net.minecraft.data.client.Models;
@ -17,7 +18,8 @@ public class ModelGenerator extends FabricModelProvider {
super(generator);
}
// Helper method since "normal" registerDoor doesn't account for non-flat texture dir
// HELPER METHODS TO ACCOUNT FOR NON-FLAT TEXTURE STRUCTURE ====================
public void registerDoor(BlockStateModelGenerator blockStateModelGenerator, Block doorBlock) {
TextureMap textureMap = TextureMap.topBottom(
Registries.BLOCK.getId(doorBlock).withPath((path) -> "block/doors/" + path + "_top"),
@ -34,9 +36,16 @@ public class ModelGenerator extends FabricModelProvider {
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createDoorBlockState(doorBlock, identifier, identifier2, identifier3, identifier4, identifier5, identifier6, identifier7, identifier8));
}
public void registerCube(BlockStateModelGenerator blockStateModelGenerator, Block block, String texturePath) {
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(block).withPath((path) -> "block/" + texturePath + "/" + path));
Identifier model_id = Models.CUBE_ALL.upload(block, textureMap, blockStateModelGenerator.modelCollector);
blockStateModelGenerator.blockStateCollector.accept(blockStateModelGenerator.createSingletonBlockState(block, model_id));
}
@Override
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
// BlockStateModelGenerator.createSingletonBlockState(NSE_Blocks.SAND_TILES, new Identifier("new_soviet", "block/sand_tiles"));
// BlockStateModelGenerator.createSlabBlockState()
// BlockStateModelGenerator.createWallBlockState()
// BlockStateModelGenerator.createStairsBlockState(NSE_Blocks.SAND_TILES_STAIRS, new Identifier(NewSoviet.MOD_ID, "sand_tiles_stairs"));
@ -45,6 +54,174 @@ public class ModelGenerator extends FabricModelProvider {
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_OAK_DOOR);
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_MANGROVE_DOOR);
registerCube(blockStateModelGenerator, NSE_Blocks.SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_SAND_TILES, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_SAND_BRICKS, "sand");
registerCube(blockStateModelGenerator, NSE_Blocks.BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.DIRTY_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.DARK_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_DARK_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_DARK_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.DIRTY_DARK_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GLAZED_BRICK_TILES, "brick");
registerCube(blockStateModelGenerator, NSE_Blocks.RED_BRICKS, "red");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_RED_BRICKS, "red");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_RED_BRICKS, "red");
registerCube(blockStateModelGenerator, NSE_Blocks.TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GLAZED_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.VARIATED_TEAL_TILES, "teal");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GREEN_TILES, "green");
// Cracked big are variated!
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_BRICKS, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_BRICKS, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_GREEN_BRICKS, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_BRICKS_2, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_BRICKS_2, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_GREEN_BRICKS_2, "green");
registerCube(blockStateModelGenerator, NSE_Blocks.AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.DIRTY_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GLAZED_AQUAMARINE_TILES, "aquamarine");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_DIORITE_TILES, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_DIORITE_TILES, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_DIORITE_TILES, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.DIORITE_BRICKS, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_DIORITE_BRICKS, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_DIORITE_BRICKS, "diorite");
registerCube(blockStateModelGenerator, NSE_Blocks.CALCITE_TILES, "calcite");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_CALCITE_TILES, "calcite");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_CALCITE_TILES, "calcite");
registerCube(blockStateModelGenerator, NSE_Blocks.DIAGONAL_CALCITE_TILES, "calcite");
registerCube(blockStateModelGenerator, NSE_Blocks.NII_WALL_1, "research_institute");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_NII_WALL_1, "research_institute");
registerCube(blockStateModelGenerator, NSE_Blocks.NII_WALL_2, "research_institute");
registerCube(blockStateModelGenerator, NSE_Blocks.NII_WALL_3, "research_institute");
registerCube(blockStateModelGenerator, NSE_Blocks.DRIPSTONE_TILES, "dripstone");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_DRIPSTONE_TILES, "dripstone");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_DRIPSTONE_TILES, "dripstone");
registerCube(blockStateModelGenerator, NSE_Blocks.DRIPSTONE_BRICKS, "dripstone");
registerCube(blockStateModelGenerator, NSE_Blocks.DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.DIAGONAL_DEEPSLATE_TILES, "deepslate");
registerCube(blockStateModelGenerator, NSE_Blocks.LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.VARIATED_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GLAZED_LIGHT_BLUE_TILES, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.LIGHT_BLUE_BRICKS, "light_blue");
// cracked bricks are variated
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_LIGHT_BLUE_BRICKS, "light_blue");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GRANITE_TILES, "granite");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_GRANITE_TILES, "granite");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_GRANITE_TILES, "granite");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WHITE_TILES, "green_white");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_WHITE_TILES, "green_white");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_GREEN_WHITE_TILES, "green_white");
registerCube(blockStateModelGenerator, NSE_Blocks.TUFF_TILES, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_TUFF_TILES, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_TUFF_TILES, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_TUFF_TILES, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.TUFF_BRICKS, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_TUFF_BRICKS, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_TUFF_BRICKS, "tuff");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_WHITE_TILES, "white");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_WHITE_TILES, "white");
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_WHITE_TILES, "white");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GLAZED_WHITE_TILES, "white");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_YELLOW_TILES, "yellow");
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_CRACKED_YELLOW_TILES, "yellow");
registerCube(blockStateModelGenerator, NSE_Blocks.WHITEWASH, "whitewash");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_WHITEWASH, "whitewash");
registerCube(blockStateModelGenerator, NSE_Blocks.VERY_CRACKED_WHITEWASH, "whitewash");
registerCube(blockStateModelGenerator, NSE_Blocks.WHITE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_WHITE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.BEIGE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_BEIGE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.BLUE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_BLUE_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.RED_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_RED_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.YELLOW_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_YELLOW_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_CONCRETE, "concrete");
registerCube(blockStateModelGenerator, NSE_Blocks.NII_FLOOR, "research_institute");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_ACACIA_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_ACACIA_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_OAK_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_OAK_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_BIRCH_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_BIRCH_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_CRIMSON_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_CRIMSON_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_DARK_OAK_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_DARK_OAK_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_JUNGLE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_JUNGLE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_MANGROVE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_MANGROVE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_SPRUCE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_SPRUCE_PLANKS, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.HERRINGBONE_PARQUET, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.STRAIGHT_PARQUET, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.SEPARATED_PARQUET, "floor/planks");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.BLUE_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.RED_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.GRAY_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.ORANGE_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.BROWN_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.CYAN_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_ORANGE_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.CROSS_BROWN_LINOLEUM, "floor/linoleum");
registerCube(blockStateModelGenerator, NSE_Blocks.INDUSTRIAL_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.GRAY_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.RED_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.ORANGE_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.YELLOW_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.LIME_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.CYAN_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.LIGHT_BLUE_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.BLUE_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.PURPLE_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.MAGENTA_WARNING, "industrial/warning");
registerCube(blockStateModelGenerator, NSE_Blocks.METAL_PLATING, "industrial");
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WALLPAPER, "wallpapers");
registerCube(blockStateModelGenerator, NSE_Blocks.BROWN_WALLPAPER, "wallpapers");
registerCube(blockStateModelGenerator, NSE_Blocks.BEIGE_WALLPAPER, "wallpapers");
// BlockStateModelGenerator.createSlabBlockState()
// blockStateModelGenerator.registerSimpleCubeAll(NSE_Blocks.SAND_TILES);
// BlockStateModelGenerator.createSingletonBlockState(NSE_Blocks.SAND_TILES, new Identifier("new_soviet", "block/sand_tiles"));
// blockStateModelGenerator.register();
}