Skip to content

Commit

Permalink
wip: dyeable ovens
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Feb 16, 2024
1 parent 704769f commit 74fe008
Show file tree
Hide file tree
Showing 58 changed files with 862 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.Block;

import java.util.concurrent.CompletableFuture;
Expand Down Expand Up @@ -53,6 +54,12 @@ protected void addTags(HolderLookup.Provider arg) {
ModBlocks.hangingCorner);

getOrCreateTagBuilder(ModBlockTags.OVENS).add(ModBlocks.ovens);
final var dyedOvens = getOrCreateTagBuilder(ModBlockTags.DYED_OVENS);
for (final var oven : ModBlocks.ovens) {
if (oven.getColor() != DyeColor.WHITE) {
dyedOvens.add(oven);
}
}

final var kitchenConnectors = getOrCreateTagBuilder(ModBlockTags.KITCHEN_CONNECTORS);
kitchenConnectors.add(ModBlocks.corner, ModBlocks.hangingCorner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.fabricmc.fabric.api.datagen.v1.provider.FabricTagProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.Registries;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;

Expand All @@ -31,5 +32,12 @@ protected void addTags(HolderLookup.Provider lookup) {
for (final var oven : ModBlocks.ovens) {
ovens.add(oven.asItem());
}

final var dyedOvens = getOrCreateTagBuilder(ModItemTags.DYED_OVENS);
for (final var oven : ModBlocks.ovens) {
if (oven.getColor() != DyeColor.WHITE) {
dyedOvens.add(oven.asItem());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ private void createOvenBlock(BlockModelGenerators blockStateModelGenerator, Oven
final var textureMapping = getOvenTextures(block);
final var ovenModel = ovenTemplate.create(block, textureMapping, blockStateModelGenerator.modelOutput);
final var activeTextureMapping = getOvenTextures(block);
activeTextureMapping.putForced(TextureSlot.create("ovenfront"), new ResourceLocation("cookingforblockheads", "block/" + block.getColor().getName() + "_oven_front_active"));
activeTextureMapping.putForced(TextureSlot.create("ovenfront"),
new ResourceLocation("cookingforblockheads", "block/" + block.getColor().getName() + "_oven_front_active"));
final var activeOvenModel = ovenTemplate.createWithSuffix(block, "_active", activeTextureMapping, blockStateModelGenerator.modelOutput);
blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(block)
.with(createBooleanModelDispatch(OvenBlock.ACTIVE, ovenModel, activeOvenModel))
Expand All @@ -90,7 +91,8 @@ private void createOvenBlock(BlockModelGenerators blockStateModelGenerator, Oven

final var ovenDoorTemplate = new ModelTemplate(Optional.of(new ResourceLocation("cookingforblockheads", "block/dyed_oven_door")), Optional.empty());
ovenDoorTemplate.createWithSuffix(block, "_door", textureMapping, blockStateModelGenerator.modelOutput);
final var ovenDoorActiveTemplate = new ModelTemplate(Optional.of(new ResourceLocation("cookingforblockheads", "block/dyed_oven_door_active")), Optional.empty());
final var ovenDoorActiveTemplate = new ModelTemplate(Optional.of(new ResourceLocation("cookingforblockheads", "block/dyed_oven_door_active")),
Optional.empty());
ovenDoorActiveTemplate.createWithSuffix(block, "_door_active", activeTextureMapping, blockStateModelGenerator.modelOutput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void buildRecipes(RecipeOutput exporter) {
.requires(ModItemTags.DYED_OVENS)
.requires(dyeItemTags[color.ordinal()])
.unlockedBy("has_oven", has(ModBlocks.ovens[DyeColor.WHITE.ordinal()]))
.save(exporter);
.save(exporter, "dye_" + color.getSerializedName() + "_oven");
}

shapeless(RecipeCategory.DECORATIONS, ModBlocks.fridge)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/blue_oven_side",
"ovenbottom": "cookingforblockheads:block/blue_oven_bottom",
"ovenfront": "cookingforblockheads:block/blue_oven_front",
"ovenfront": "cookingforblockheads:block/blue_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/blue_oven_front_active",
"oventop": "cookingforblockheads:block/blue_oven_top",
"particle": "cookingforblockheads:block/blue_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/blue_oven_side",
"ovenbottom": "cookingforblockheads:block/blue_oven_bottom",
"ovenfront": "cookingforblockheads:block/blue_oven_front",
"ovenfront": "cookingforblockheads:block/blue_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/blue_oven_front_active",
"oventop": "cookingforblockheads:block/blue_oven_top",
"particle": "cookingforblockheads:block/blue_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/brown_oven_side",
"ovenbottom": "cookingforblockheads:block/brown_oven_bottom",
"ovenfront": "cookingforblockheads:block/brown_oven_front",
"ovenfront": "cookingforblockheads:block/brown_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/brown_oven_front_active",
"oventop": "cookingforblockheads:block/brown_oven_top",
"particle": "cookingforblockheads:block/brown_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/brown_oven_side",
"ovenbottom": "cookingforblockheads:block/brown_oven_bottom",
"ovenfront": "cookingforblockheads:block/brown_oven_front",
"ovenfront": "cookingforblockheads:block/brown_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/brown_oven_front_active",
"oventop": "cookingforblockheads:block/brown_oven_top",
"particle": "cookingforblockheads:block/brown_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/green_oven_side",
"ovenbottom": "cookingforblockheads:block/green_oven_bottom",
"ovenfront": "cookingforblockheads:block/green_oven_front",
"ovenfront": "cookingforblockheads:block/green_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/green_oven_front_active",
"oventop": "cookingforblockheads:block/green_oven_top",
"particle": "cookingforblockheads:block/green_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/green_oven_side",
"ovenbottom": "cookingforblockheads:block/green_oven_bottom",
"ovenfront": "cookingforblockheads:block/green_oven_front",
"ovenfront": "cookingforblockheads:block/green_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/green_oven_front_active",
"oventop": "cookingforblockheads:block/green_oven_top",
"particle": "cookingforblockheads:block/green_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/light_blue_oven_side",
"ovenbottom": "cookingforblockheads:block/light_blue_oven_bottom",
"ovenfront": "cookingforblockheads:block/light_blue_oven_front",
"ovenfront": "cookingforblockheads:block/light_blue_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/light_blue_oven_front_active",
"oventop": "cookingforblockheads:block/light_blue_oven_top",
"particle": "cookingforblockheads:block/light_blue_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/light_blue_oven_side",
"ovenbottom": "cookingforblockheads:block/light_blue_oven_bottom",
"ovenfront": "cookingforblockheads:block/light_blue_oven_front",
"ovenfront": "cookingforblockheads:block/light_blue_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/light_blue_oven_front_active",
"oventop": "cookingforblockheads:block/light_blue_oven_top",
"particle": "cookingforblockheads:block/light_blue_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/lime_oven_side",
"ovenbottom": "cookingforblockheads:block/lime_oven_bottom",
"ovenfront": "cookingforblockheads:block/lime_oven_front",
"ovenfront": "cookingforblockheads:block/lime_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/lime_oven_front_active",
"oventop": "cookingforblockheads:block/lime_oven_top",
"particle": "cookingforblockheads:block/lime_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/lime_oven_side",
"ovenbottom": "cookingforblockheads:block/lime_oven_bottom",
"ovenfront": "cookingforblockheads:block/lime_oven_front",
"ovenfront": "cookingforblockheads:block/lime_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/lime_oven_front_active",
"oventop": "cookingforblockheads:block/lime_oven_top",
"particle": "cookingforblockheads:block/lime_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/magenta_oven_side",
"ovenbottom": "cookingforblockheads:block/magenta_oven_bottom",
"ovenfront": "cookingforblockheads:block/magenta_oven_front",
"ovenfront": "cookingforblockheads:block/magenta_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/magenta_oven_front_active",
"oventop": "cookingforblockheads:block/magenta_oven_top",
"particle": "cookingforblockheads:block/magenta_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/magenta_oven_side",
"ovenbottom": "cookingforblockheads:block/magenta_oven_bottom",
"ovenfront": "cookingforblockheads:block/magenta_oven_front",
"ovenfront": "cookingforblockheads:block/magenta_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/magenta_oven_front_active",
"oventop": "cookingforblockheads:block/magenta_oven_top",
"particle": "cookingforblockheads:block/magenta_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/orange_oven_side",
"ovenbottom": "cookingforblockheads:block/orange_oven_bottom",
"ovenfront": "cookingforblockheads:block/orange_oven_front",
"ovenfront": "cookingforblockheads:block/orange_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/orange_oven_front_active",
"oventop": "cookingforblockheads:block/orange_oven_top",
"particle": "cookingforblockheads:block/orange_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/pink_oven_side",
"ovenbottom": "cookingforblockheads:block/pink_oven_bottom",
"ovenfront": "cookingforblockheads:block/pink_oven_front",
"ovenfront": "cookingforblockheads:block/pink_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/pink_oven_front_active",
"oventop": "cookingforblockheads:block/pink_oven_top",
"particle": "cookingforblockheads:block/pink_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/purple_oven_side",
"ovenbottom": "cookingforblockheads:block/purple_oven_bottom",
"ovenfront": "cookingforblockheads:block/purple_oven_front",
"ovenfront": "cookingforblockheads:block/purple_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/purple_oven_front_active",
"oventop": "cookingforblockheads:block/purple_oven_top",
"particle": "cookingforblockheads:block/purple_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/purple_oven_side",
"ovenbottom": "cookingforblockheads:block/purple_oven_bottom",
"ovenfront": "cookingforblockheads:block/purple_oven_front",
"ovenfront": "cookingforblockheads:block/purple_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/purple_oven_front_active",
"oventop": "cookingforblockheads:block/purple_oven_top",
"particle": "cookingforblockheads:block/purple_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/red_oven_side",
"ovenbottom": "cookingforblockheads:block/red_oven_bottom",
"ovenfront": "cookingforblockheads:block/red_oven_front",
"ovenfront": "cookingforblockheads:block/red_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/red_oven_front_active",
"oventop": "cookingforblockheads:block/red_oven_top",
"particle": "cookingforblockheads:block/red_oven_side",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"textures": {
"backsplash": "cookingforblockheads:block/red_oven_side",
"ovenbottom": "cookingforblockheads:block/red_oven_bottom",
"ovenfront": "cookingforblockheads:block/red_oven_front",
"ovenfront": "cookingforblockheads:block/red_oven_front_active",
"ovenfront_active": "cookingforblockheads:block/red_oven_front_active",
"oventop": "cookingforblockheads:block/red_oven_top",
"particle": "cookingforblockheads:block/red_oven_side",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_oven": {
"conditions": {
"items": [
{
"items": [
"cookingforblockheads:oven"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "minecraft:dye_black_oven"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_oven"
]
],
"rewards": {
"recipes": [
"minecraft:dye_black_oven"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_oven": {
"conditions": {
"items": [
{
"items": [
"cookingforblockheads:oven"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "minecraft:dye_blue_oven"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_oven"
]
],
"rewards": {
"recipes": [
"minecraft:dye_blue_oven"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_oven": {
"conditions": {
"items": [
{
"items": [
"cookingforblockheads:oven"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "minecraft:dye_brown_oven"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_oven"
]
],
"rewards": {
"recipes": [
"minecraft:dye_brown_oven"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"parent": "minecraft:recipes/root",
"criteria": {
"has_oven": {
"conditions": {
"items": [
{
"items": [
"cookingforblockheads:oven"
]
}
]
},
"trigger": "minecraft:inventory_changed"
},
"has_the_recipe": {
"conditions": {
"recipe": "minecraft:dye_cyan_oven"
},
"trigger": "minecraft:recipe_unlocked"
}
},
"requirements": [
[
"has_the_recipe",
"has_oven"
]
],
"rewards": {
"recipes": [
"minecraft:dye_cyan_oven"
]
}
}
Loading

0 comments on commit 74fe008

Please sign in to comment.