diff --git a/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModDataGenerator.java b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModDataGenerator.java index 382c408d..95ebef87 100644 --- a/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModDataGenerator.java +++ b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModDataGenerator.java @@ -9,6 +9,7 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); pack.addProvider(ModBlockTagProvider::new); pack.addProvider(ModItemTagProvider::new); + pack.addProvider(ModEntityTypeTagProvider::new); pack.addProvider(ModBlockLootTableProvider::new); pack.addProvider(ModModelProvider::new); pack.addProvider(ModRecipeProvider::new); diff --git a/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModEntityTypeTagProvider.java b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModEntityTypeTagProvider.java new file mode 100644 index 00000000..cf1b3f84 --- /dev/null +++ b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModEntityTypeTagProvider.java @@ -0,0 +1,21 @@ +package net.blay09.mods.cookingforblockheads.fabric.datagen; + +import net.blay09.mods.cookingforblockheads.tag.ModEntityTypeTags; +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.registries.Registries; +import net.minecraft.world.entity.EntityType; + +import java.util.concurrent.CompletableFuture; + +public class ModEntityTypeTagProvider extends FabricTagProvider> { + public ModEntityTypeTagProvider(FabricDataOutput output, CompletableFuture registriesFuture) { + super(output, Registries.ENTITY_TYPE, registriesFuture); + } + + @Override + protected void addTags(HolderLookup.Provider arg) { + getOrCreateTagBuilder(ModEntityTypeTags.COW).add(EntityType.COW); + } +} diff --git a/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModModelProvider.java b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModModelProvider.java index 276322ed..8537ab76 100644 --- a/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModModelProvider.java +++ b/fabric/src/main/java/net/blay09/mods/cookingforblockheads/fabric/datagen/ModModelProvider.java @@ -16,6 +16,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; import net.minecraft.world.level.block.Block; +import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -68,21 +69,12 @@ public void generateItemModels(ItemModelGenerators itemModelGenerator) { final var ovenTemplate = new ModelTemplate(Optional.of(new ResourceLocation("cookingforblockheads", "item/dyed_oven")), Optional.empty()); for (final var oven : ModBlocks.ovens) { final var modelLocation = ModelLocationUtils.getModelLocation(oven.asItem()); - final var textureMapping = new TextureMapping(); - final var colorName = oven.getColor().getName(); - textureMapping.putForced(TextureSlot.PARTICLE, new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); - textureMapping.putForced(TextureSlot.TEXTURE, new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); - textureMapping.putForced(TextureSlot.create("ovenfront"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_front")); - textureMapping.putForced(TextureSlot.create("ovenfront_active"), - new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_front_active")); - textureMapping.putForced(TextureSlot.create("oventop"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_top")); - textureMapping.putForced(TextureSlot.create("ovenbottom"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_bottom")); - textureMapping.putForced(TextureSlot.create("backsplash"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); + final var textureMapping = getOvenTextures(oven); ovenTemplate.create(modelLocation, textureMapping, itemModelGenerator.output); } } - private void createOvenBlock(BlockModelGenerators blockStateModelGenerator, Block block) { + private void createOvenBlock(BlockModelGenerators blockStateModelGenerator, OvenBlock block) { final var dispatch = PropertyDispatch.properties(OvenBlock.ACTIVE, OvenBlock.POWERED); for (var active = 0; active <= 1; active++) { for (var powered = 0; powered <= 1; powered++) { @@ -102,6 +94,25 @@ private void createOvenBlock(BlockModelGenerators blockStateModelGenerator, Bloc .with(dispatch); blockStateModelGenerator.blockStateOutput.accept(generator); blockStateModelGenerator.skipAutoItemBlock(block); + + final var ovenTemplate = new ModelTemplate(Optional.of(new ResourceLocation("cookingforblockheads", "block/dyed_oven")), Optional.empty()); + final var textureMapping = getOvenTextures(block); + ovenTemplate.create(block, textureMapping, blockStateModelGenerator.modelOutput); + } + + @NotNull + private static TextureMapping getOvenTextures(OvenBlock oven) { + final var textureMapping = new TextureMapping(); + final var colorName = oven.getColor().getName(); + textureMapping.putForced(TextureSlot.PARTICLE, new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); + textureMapping.putForced(TextureSlot.TEXTURE, new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); + textureMapping.putForced(TextureSlot.create("ovenfront"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_front")); + textureMapping.putForced(TextureSlot.create("ovenfront_active"), + new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_front_active")); + textureMapping.putForced(TextureSlot.create("oventop"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_top")); + textureMapping.putForced(TextureSlot.create("ovenbottom"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_bottom")); + textureMapping.putForced(TextureSlot.create("backsplash"), new ResourceLocation("cookingforblockheads", "block/" + colorName + "_oven_side")); + return textureMapping; } } diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/black_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/black_oven.json new file mode 100644 index 00000000..167fb668 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/black_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/black_oven_side", + "ovenbottom": "cookingforblockheads:block/black_oven_bottom", + "ovenfront": "cookingforblockheads:block/black_oven_front", + "ovenfront_active": "cookingforblockheads:block/black_oven_front_active", + "oventop": "cookingforblockheads:block/black_oven_top", + "particle": "cookingforblockheads:block/black_oven_side", + "texture": "cookingforblockheads:block/black_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/blue_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/blue_oven.json new file mode 100644 index 00000000..1d12cf64 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/blue_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/blue_oven_side", + "ovenbottom": "cookingforblockheads:block/blue_oven_bottom", + "ovenfront": "cookingforblockheads:block/blue_oven_front", + "ovenfront_active": "cookingforblockheads:block/blue_oven_front_active", + "oventop": "cookingforblockheads:block/blue_oven_top", + "particle": "cookingforblockheads:block/blue_oven_side", + "texture": "cookingforblockheads:block/blue_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/brown_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/brown_oven.json new file mode 100644 index 00000000..c43a5c78 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/brown_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/brown_oven_side", + "ovenbottom": "cookingforblockheads:block/brown_oven_bottom", + "ovenfront": "cookingforblockheads:block/brown_oven_front", + "ovenfront_active": "cookingforblockheads:block/brown_oven_front_active", + "oventop": "cookingforblockheads:block/brown_oven_top", + "particle": "cookingforblockheads:block/brown_oven_side", + "texture": "cookingforblockheads:block/brown_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/cyan_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/cyan_oven.json new file mode 100644 index 00000000..9c9669be --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/cyan_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/cyan_oven_side", + "ovenbottom": "cookingforblockheads:block/cyan_oven_bottom", + "ovenfront": "cookingforblockheads:block/cyan_oven_front", + "ovenfront_active": "cookingforblockheads:block/cyan_oven_front_active", + "oventop": "cookingforblockheads:block/cyan_oven_top", + "particle": "cookingforblockheads:block/cyan_oven_side", + "texture": "cookingforblockheads:block/cyan_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/gray_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/gray_oven.json new file mode 100644 index 00000000..09aa7dcd --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/gray_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/gray_oven_side", + "ovenbottom": "cookingforblockheads:block/gray_oven_bottom", + "ovenfront": "cookingforblockheads:block/gray_oven_front", + "ovenfront_active": "cookingforblockheads:block/gray_oven_front_active", + "oventop": "cookingforblockheads:block/gray_oven_top", + "particle": "cookingforblockheads:block/gray_oven_side", + "texture": "cookingforblockheads:block/gray_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/green_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/green_oven.json new file mode 100644 index 00000000..e0ea2d07 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/green_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/green_oven_side", + "ovenbottom": "cookingforblockheads:block/green_oven_bottom", + "ovenfront": "cookingforblockheads:block/green_oven_front", + "ovenfront_active": "cookingforblockheads:block/green_oven_front_active", + "oventop": "cookingforblockheads:block/green_oven_top", + "particle": "cookingforblockheads:block/green_oven_side", + "texture": "cookingforblockheads:block/green_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_blue_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_blue_oven.json new file mode 100644 index 00000000..fcf316d8 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_blue_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/light_blue_oven_side", + "ovenbottom": "cookingforblockheads:block/light_blue_oven_bottom", + "ovenfront": "cookingforblockheads:block/light_blue_oven_front", + "ovenfront_active": "cookingforblockheads:block/light_blue_oven_front_active", + "oventop": "cookingforblockheads:block/light_blue_oven_top", + "particle": "cookingforblockheads:block/light_blue_oven_side", + "texture": "cookingforblockheads:block/light_blue_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_gray_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_gray_oven.json new file mode 100644 index 00000000..c1e9951f --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/light_gray_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/light_gray_oven_side", + "ovenbottom": "cookingforblockheads:block/light_gray_oven_bottom", + "ovenfront": "cookingforblockheads:block/light_gray_oven_front", + "ovenfront_active": "cookingforblockheads:block/light_gray_oven_front_active", + "oventop": "cookingforblockheads:block/light_gray_oven_top", + "particle": "cookingforblockheads:block/light_gray_oven_side", + "texture": "cookingforblockheads:block/light_gray_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/lime_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/lime_oven.json new file mode 100644 index 00000000..809efe93 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/lime_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/lime_oven_side", + "ovenbottom": "cookingforblockheads:block/lime_oven_bottom", + "ovenfront": "cookingforblockheads:block/lime_oven_front", + "ovenfront_active": "cookingforblockheads:block/lime_oven_front_active", + "oventop": "cookingforblockheads:block/lime_oven_top", + "particle": "cookingforblockheads:block/lime_oven_side", + "texture": "cookingforblockheads:block/lime_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/magenta_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/magenta_oven.json new file mode 100644 index 00000000..9eade521 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/magenta_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/magenta_oven_side", + "ovenbottom": "cookingforblockheads:block/magenta_oven_bottom", + "ovenfront": "cookingforblockheads:block/magenta_oven_front", + "ovenfront_active": "cookingforblockheads:block/magenta_oven_front_active", + "oventop": "cookingforblockheads:block/magenta_oven_top", + "particle": "cookingforblockheads:block/magenta_oven_side", + "texture": "cookingforblockheads:block/magenta_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/orange_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/orange_oven.json new file mode 100644 index 00000000..6bcb7082 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/orange_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/orange_oven_side", + "ovenbottom": "cookingforblockheads:block/orange_oven_bottom", + "ovenfront": "cookingforblockheads:block/orange_oven_front", + "ovenfront_active": "cookingforblockheads:block/orange_oven_front_active", + "oventop": "cookingforblockheads:block/orange_oven_top", + "particle": "cookingforblockheads:block/orange_oven_side", + "texture": "cookingforblockheads:block/orange_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/oven.json new file mode 100644 index 00000000..c054a708 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/white_oven_side", + "ovenbottom": "cookingforblockheads:block/white_oven_bottom", + "ovenfront": "cookingforblockheads:block/white_oven_front", + "ovenfront_active": "cookingforblockheads:block/white_oven_front_active", + "oventop": "cookingforblockheads:block/white_oven_top", + "particle": "cookingforblockheads:block/white_oven_side", + "texture": "cookingforblockheads:block/white_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/pink_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/pink_oven.json new file mode 100644 index 00000000..0b28673d --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/pink_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/pink_oven_side", + "ovenbottom": "cookingforblockheads:block/pink_oven_bottom", + "ovenfront": "cookingforblockheads:block/pink_oven_front", + "ovenfront_active": "cookingforblockheads:block/pink_oven_front_active", + "oventop": "cookingforblockheads:block/pink_oven_top", + "particle": "cookingforblockheads:block/pink_oven_side", + "texture": "cookingforblockheads:block/pink_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/purple_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/purple_oven.json new file mode 100644 index 00000000..afe3b6a0 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/purple_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/purple_oven_side", + "ovenbottom": "cookingforblockheads:block/purple_oven_bottom", + "ovenfront": "cookingforblockheads:block/purple_oven_front", + "ovenfront_active": "cookingforblockheads:block/purple_oven_front_active", + "oventop": "cookingforblockheads:block/purple_oven_top", + "particle": "cookingforblockheads:block/purple_oven_side", + "texture": "cookingforblockheads:block/purple_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/red_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/red_oven.json new file mode 100644 index 00000000..f15f0190 --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/red_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/red_oven_side", + "ovenbottom": "cookingforblockheads:block/red_oven_bottom", + "ovenfront": "cookingforblockheads:block/red_oven_front", + "ovenfront_active": "cookingforblockheads:block/red_oven_front_active", + "oventop": "cookingforblockheads:block/red_oven_top", + "particle": "cookingforblockheads:block/red_oven_side", + "texture": "cookingforblockheads:block/red_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/generated/resources/assets/cookingforblockheads/models/block/yellow_oven.json b/shared/src/generated/resources/assets/cookingforblockheads/models/block/yellow_oven.json new file mode 100644 index 00000000..3a7e3f0e --- /dev/null +++ b/shared/src/generated/resources/assets/cookingforblockheads/models/block/yellow_oven.json @@ -0,0 +1,12 @@ +{ + "parent": "cookingforblockheads:block/dyed_oven", + "textures": { + "backsplash": "cookingforblockheads:block/yellow_oven_side", + "ovenbottom": "cookingforblockheads:block/yellow_oven_bottom", + "ovenfront": "cookingforblockheads:block/yellow_oven_front", + "ovenfront_active": "cookingforblockheads:block/yellow_oven_front_active", + "oventop": "cookingforblockheads:block/yellow_oven_top", + "particle": "cookingforblockheads:block/yellow_oven_side", + "texture": "cookingforblockheads:block/yellow_oven_side" + } +} \ No newline at end of file diff --git a/shared/src/main/java/net/blay09/mods/cookingforblockheads/tag/ModEntityTypeTags.java b/shared/src/main/java/net/blay09/mods/cookingforblockheads/tag/ModEntityTypeTags.java index b1c852df..256b3e94 100644 --- a/shared/src/main/java/net/blay09/mods/cookingforblockheads/tag/ModEntityTypeTags.java +++ b/shared/src/main/java/net/blay09/mods/cookingforblockheads/tag/ModEntityTypeTags.java @@ -5,7 +5,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; -import net.minecraft.world.level.block.Block; public class ModEntityTypeTags { public static final TagKey> COW = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(CookingForBlockheads.MOD_ID, "cows")); diff --git a/shared/src/main/resources/assets/cookingforblockheads/models/block/oven.json b/shared/src/main/resources/assets/cookingforblockheads/models/block/dyed_oven.json similarity index 100% rename from shared/src/main/resources/assets/cookingforblockheads/models/block/oven.json rename to shared/src/main/resources/assets/cookingforblockheads/models/block/dyed_oven.json