Improve datagen
This commit is contained in:
parent
d20f76caf0
commit
e997a0a281
10 changed files with 58 additions and 31 deletions
8
src/main/generated/data/new_soviet/tags/items/dice.json
Normal file
8
src/main/generated/data/new_soviet/tags/items/dice.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"new_soviet:dice_d4",
|
||||||
|
"new_soviet:dice_d6",
|
||||||
|
"new_soviet:dice_d20"
|
||||||
|
]
|
||||||
|
}
|
|
@ -7,6 +7,7 @@ import su.a71.new_soviet.datagen.BlockLootTables;
|
||||||
import su.a71.new_soviet.datagen.BlockTagGenerator;
|
import su.a71.new_soviet.datagen.BlockTagGenerator;
|
||||||
import su.a71.new_soviet.datagen.RecipeGenerator;
|
import su.a71.new_soviet.datagen.RecipeGenerator;
|
||||||
import su.a71.new_soviet.datagen.ModelGenerator;
|
import su.a71.new_soviet.datagen.ModelGenerator;
|
||||||
|
import su.a71.new_soviet.datagen.ItemTagGenerator;
|
||||||
|
|
||||||
public class DataGeneration implements DataGeneratorEntrypoint {
|
public class DataGeneration implements DataGeneratorEntrypoint {
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,5 +17,6 @@ public class DataGeneration implements DataGeneratorEntrypoint {
|
||||||
NSEPack.addProvider(RecipeGenerator::new);
|
NSEPack.addProvider(RecipeGenerator::new);
|
||||||
NSEPack.addProvider(BlockTagGenerator::new);
|
NSEPack.addProvider(BlockTagGenerator::new);
|
||||||
NSEPack.addProvider(ModelGenerator::new);
|
NSEPack.addProvider(ModelGenerator::new);
|
||||||
|
NSEPack.addProvider(ItemTagGenerator::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
package su.a71.new_soviet.datagen;
|
||||||
|
// === ABANDON HOPE, YE WHO ENTER HERE ===
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
|
||||||
|
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
|
||||||
|
import net.minecraft.registry.RegistryWrapper;
|
||||||
|
|
||||||
|
import su.a71.new_soviet.registration.NSE_Items;
|
||||||
|
import su.a71.new_soviet.registration.NSE_Tags;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
|
||||||
|
|
||||||
|
public class ItemTagGenerator extends FabricTagProvider.ItemTagProvider {
|
||||||
|
|
||||||
|
public ItemTagGenerator(FabricDataOutput output, CompletableFuture<RegistryWrapper.WrapperLookup> completableFuture) {
|
||||||
|
super(output, completableFuture);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(RegistryWrapper.WrapperLookup arg) {
|
||||||
|
getOrCreateTagBuilder(NSE_Tags.Items.DICE)
|
||||||
|
.add(NSE_Items.DICE_D4)
|
||||||
|
.add(NSE_Items.DICE_D6)
|
||||||
|
.add(NSE_Items.DICE_D20);
|
||||||
|
}
|
||||||
|
}
|
|
@ -6,14 +6,9 @@ import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SlabBlock;
|
import net.minecraft.block.SlabBlock;
|
||||||
import net.minecraft.block.StairsBlock;
|
import net.minecraft.block.StairsBlock;
|
||||||
import net.minecraft.data.client.BlockStateModelGenerator;
|
import net.minecraft.data.client.*;
|
||||||
import net.minecraft.data.client.ItemModelGenerator;
|
|
||||||
import net.minecraft.data.client.Models;
|
|
||||||
import net.minecraft.data.client.TextureMap;
|
|
||||||
import net.minecraft.registry.Registries;
|
import net.minecraft.registry.Registries;
|
||||||
import net.minecraft.structure.StrongholdGenerator;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import org.apache.http.impl.io.IdentityInputStream;
|
|
||||||
import su.a71.new_soviet.registration.NSE_Blocks;
|
import su.a71.new_soviet.registration.NSE_Blocks;
|
||||||
|
|
||||||
public class ModelGenerator extends FabricModelProvider {
|
public class ModelGenerator extends FabricModelProvider {
|
||||||
|
@ -27,6 +22,8 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
TextureMap textureMap = TextureMap.topBottom(
|
TextureMap textureMap = TextureMap.topBottom(
|
||||||
Registries.BLOCK.getId(doorBlock).withPath((path) -> "block/doors/" + path + "_top"),
|
Registries.BLOCK.getId(doorBlock).withPath((path) -> "block/doors/" + path + "_top"),
|
||||||
Registries.BLOCK.getId(doorBlock).withPath((path) -> "block/doors/" + path + "_bottom"));
|
Registries.BLOCK.getId(doorBlock).withPath((path) -> "block/doors/" + path + "_bottom"));
|
||||||
|
TextureMap textureMapItem = TextureMap.layer0(Registries.BLOCK.getId(doorBlock).withPath((path) -> "item/doors/" + path));
|
||||||
|
|
||||||
Identifier identifier = Models.DOOR_BOTTOM_LEFT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier = Models.DOOR_BOTTOM_LEFT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier identifier2 = Models.DOOR_BOTTOM_LEFT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier2 = Models.DOOR_BOTTOM_LEFT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier identifier3 = Models.DOOR_BOTTOM_RIGHT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier3 = Models.DOOR_BOTTOM_RIGHT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
|
@ -35,23 +32,22 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
Identifier identifier6 = Models.DOOR_TOP_LEFT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier6 = Models.DOOR_TOP_LEFT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier identifier7 = Models.DOOR_TOP_RIGHT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier7 = Models.DOOR_TOP_RIGHT.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier identifier8 = Models.DOOR_TOP_RIGHT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier identifier8 = Models.DOOR_TOP_RIGHT_OPEN.upload(doorBlock, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
blockStateModelGenerator.registerItemModel(doorBlock.asItem());
|
Models.GENERATED.upload(ModelIds.getItemModelId(doorBlock.asItem()), textureMapItem, blockStateModelGenerator.modelCollector);
|
||||||
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createDoorBlockState(doorBlock, identifier, identifier2, identifier3, identifier4, identifier5, identifier6, identifier7, identifier8));
|
blockStateModelGenerator.blockStateCollector.accept(BlockStateModelGenerator.createDoorBlockState(doorBlock, identifier, identifier2, identifier3, identifier4, identifier5, identifier6, identifier7, identifier8));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerCube(BlockStateModelGenerator blockStateModelGenerator, Block block, String texturePath) {
|
public void registerCube(BlockStateModelGenerator blockStateModelGenerator, Block block, String texturePath) {
|
||||||
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(block).withPath((path) -> "block/" + texturePath + "/" + path));
|
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(block).withPath((path) -> "block/" + texturePath + "/" + path));
|
||||||
Identifier model_id = Models.CUBE_ALL.upload(block, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier model_id = Models.CUBE_ALL.upload(block, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
// blockStateModelGenerator.registerItemModel(doorBlock.asItem());
|
|
||||||
blockStateModelGenerator.blockStateCollector.accept(blockStateModelGenerator.createSingletonBlockState(block, model_id));
|
blockStateModelGenerator.blockStateCollector.accept(blockStateModelGenerator.createSingletonBlockState(block, model_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerSlabStairs(BlockStateModelGenerator blockStateModelGenerator, Block parent, StairsBlock stairs, SlabBlock slab, String texturePath) {
|
public void registerSlabStairs(BlockStateModelGenerator blockStateModelGenerator, Block parent, StairsBlock stairs, SlabBlock slab, String texturePath) {
|
||||||
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(parent).withPath((path) -> "block/" + texturePath + "/" + path));
|
TextureMap textureMap = TextureMap.all(Registries.BLOCK.getId(parent).withPath((path) -> "block/" + texturePath + "/" + path));
|
||||||
|
|
||||||
Identifier slab_model = Models.SLAB.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
// Identifier slab_model = Models.SLAB.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier slab_model_top = Models.SLAB_TOP.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
// Identifier slab_model_top = Models.SLAB_TOP.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier slab_model_full = Models.CUBE_ALL.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
// Identifier slab_model_full = Models.CUBE_ALL.upload(slab, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
|
|
||||||
Identifier stairs_model = Models.STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier stairs_model = Models.STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
Identifier stairs_model_outer = Models.OUTER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
|
Identifier stairs_model_outer = Models.OUTER_STAIRS.upload(stairs, textureMap, blockStateModelGenerator.modelCollector);
|
||||||
|
@ -65,11 +61,6 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) {
|
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"));
|
|
||||||
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_BIRCH_DOOR);
|
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_BIRCH_DOOR);
|
||||||
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_SPRUCE_DOOR);
|
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_SPRUCE_DOOR);
|
||||||
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_OAK_DOOR);
|
registerDoor(blockStateModelGenerator, NSE_Blocks.CHISELED_OAK_DOOR);
|
||||||
|
@ -109,7 +100,7 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_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.VARIATED_TEAL_TILES, "teal");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GREEN_TILES, "green");
|
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GREEN_TILES, "green");
|
||||||
// Cracked big are variated!
|
// Cracked big green tiles are variated!
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_BRICKS, "green");
|
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_BRICKS, "green");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_BRICKS, "green");
|
registerCube(blockStateModelGenerator, NSE_Blocks.CRACKED_GREEN_BRICKS, "green");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_GREEN_BRICKS, "green");
|
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_GREEN_BRICKS, "green");
|
||||||
|
@ -157,7 +148,7 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.GLAZED_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.CRACKED_GLAZED_LIGHT_BLUE_TILES, "light_blue");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.LIGHT_BLUE_BRICKS, "light_blue");
|
registerCube(blockStateModelGenerator, NSE_Blocks.LIGHT_BLUE_BRICKS, "light_blue");
|
||||||
// cracked bricks are variated
|
// cracked light blue bricks are variated
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_LIGHT_BLUE_BRICKS, "light_blue");
|
registerCube(blockStateModelGenerator, NSE_Blocks.MOSSY_LIGHT_BLUE_BRICKS, "light_blue");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GRANITE_TILES, "granite");
|
registerCube(blockStateModelGenerator, NSE_Blocks.BIG_GRANITE_TILES, "granite");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_GRANITE_TILES, "granite");
|
registerCube(blockStateModelGenerator, NSE_Blocks.SMALL_GRANITE_TILES, "granite");
|
||||||
|
@ -238,13 +229,8 @@ public class ModelGenerator extends FabricModelProvider {
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WALLPAPER, "wallpapers");
|
registerCube(blockStateModelGenerator, NSE_Blocks.GREEN_WALLPAPER, "wallpapers");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.BROWN_WALLPAPER, "wallpapers");
|
registerCube(blockStateModelGenerator, NSE_Blocks.BROWN_WALLPAPER, "wallpapers");
|
||||||
registerCube(blockStateModelGenerator, NSE_Blocks.BEIGE_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"));
|
|
||||||
|
|
||||||
registerSlabStairs(blockStateModelGenerator, NSE_Blocks.SAND_TILES, NSE_Blocks.SAND_TILES_STAIRS, NSE_Blocks.SAND_TILES_SLAB, "sand");
|
// registerSlabStairs(blockStateModelGenerator, NSE_Blocks.SAND_TILES, NSE_Blocks.SAND_TILES_STAIRS, NSE_Blocks.SAND_TILES_SLAB, "sand");
|
||||||
|
|
||||||
// blockStateModelGenerator.register();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -51,9 +51,13 @@ public class NSE_BaseRegistration {
|
||||||
FabricBlockEntityTypeBuilder.create(factory, blocks).build());
|
FabricBlockEntityTypeBuilder.create(factory, blocks).build());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TagKey<Block> createTag(String name) {
|
public static TagKey<Block> createBlockTag(String name) {
|
||||||
return TagKey.of(RegistryKeys.BLOCK, new Identifier(NewSoviet.MOD_ID, name));
|
return TagKey.of(RegistryKeys.BLOCK, new Identifier(NewSoviet.MOD_ID, name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TagKey<Item> createItemTag(String name) {
|
||||||
|
return TagKey.of(RegistryKeys.ITEM, new Identifier(NewSoviet.MOD_ID, name));
|
||||||
|
}
|
||||||
|
|
||||||
public static void init() {}
|
public static void init() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package su.a71.new_soviet.registration;
|
package su.a71.new_soviet.registration;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.registry.RegistryKeys;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.registry.tag.TagKey;
|
import net.minecraft.registry.tag.TagKey;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import su.a71.new_soviet.NewSoviet;
|
|
||||||
|
|
||||||
public class NSE_Tags extends NSE_BaseRegistration{
|
public class NSE_Tags extends NSE_BaseRegistration{
|
||||||
public static class Blocks {
|
public static class Blocks {
|
||||||
public static final TagKey<Block> RAKE_MINEABLE = createTag("rake");
|
public static final TagKey<Block> RAKE_MINEABLE = createBlockTag("rake");
|
||||||
|
|
||||||
public static final TagKey<Block> TV = createTag("tv");
|
public static final TagKey<Block> TV = createBlockTag("tv");
|
||||||
public static final TagKey<Block> POST_LAMPS = createTag("post_lamps");
|
public static final TagKey<Block> POST_LAMPS = createBlockTag("post_lamps");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Items {
|
||||||
|
public static final TagKey<Item> DICE = createItemTag("dice");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue