From e92e60f13e47322d1907224bbe44e55581067334 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+blay09@users.noreply.github.com> Date: Sat, 25 May 2024 22:21:38 +0200 Subject: [PATCH] fix(1.20.6): Fix toaster model --- .../blockstates/toaster.json | 23 +++++++++++++++---- .../client/ModModels.java | 9 -------- .../fabric/datagen/ModModelProvider.java | 12 ++++++---- 3 files changed, 26 insertions(+), 18 deletions(-) diff --git a/common/src/generated/resources/assets/cookingforblockheads/blockstates/toaster.json b/common/src/generated/resources/assets/cookingforblockheads/blockstates/toaster.json index b4659611..bea0c12b 100644 --- a/common/src/generated/resources/assets/cookingforblockheads/blockstates/toaster.json +++ b/common/src/generated/resources/assets/cookingforblockheads/blockstates/toaster.json @@ -1,19 +1,34 @@ { "variants": { - "facing=east": { + "active=false,facing=east": { "model": "cookingforblockheads:block/toaster", "y": 90 }, - "facing=north": { + "active=false,facing=north": { "model": "cookingforblockheads:block/toaster" }, - "facing=south": { + "active=false,facing=south": { "model": "cookingforblockheads:block/toaster", "y": 180 }, - "facing=west": { + "active=false,facing=west": { "model": "cookingforblockheads:block/toaster", "y": 270 + }, + "active=true,facing=east": { + "model": "cookingforblockheads:block/toaster_active", + "y": 90 + }, + "active=true,facing=north": { + "model": "cookingforblockheads:block/toaster_active" + }, + "active=true,facing=south": { + "model": "cookingforblockheads:block/toaster_active", + "y": 180 + }, + "active=true,facing=west": { + "model": "cookingforblockheads:block/toaster_active", + "y": 270 } } } \ No newline at end of file diff --git a/common/src/main/java/net/blay09/mods/cookingforblockheads/client/ModModels.java b/common/src/main/java/net/blay09/mods/cookingforblockheads/client/ModModels.java index a4f4556a..d34776c1 100644 --- a/common/src/main/java/net/blay09/mods/cookingforblockheads/client/ModModels.java +++ b/common/src/main/java/net/blay09/mods/cookingforblockheads/client/ModModels.java @@ -73,15 +73,6 @@ public static void initialize(BalmModels models) { cabinetDoorsFlipped.add(color.getId() + 1, models.loadModel(id("block/" + colorPrefix + "cabinet_door_flipped"))); } - // ResourceLocation toasterModel = id("block/toaster"); - // ResourceLocation toasterActiveModel = id("block/toaster_active"); - // models.overrideModel(() -> ModBlocks.toaster, - // models.loadDynamicModel(id("block/toaster"), - // Set.of(toasterModel, toasterActiveModel), - // it -> it.getValue(ToasterBlock.ACTIVE) ? toasterActiveModel : toasterModel, - // null, - // ModModels::lowerableFacingTransforms)::get); - // ResourceLocation fridgeSmallModel = id("block/fridge"); // ResourceLocation fridgeLargeLowerModel = id("block/fridge_large_lower"); // ResourceLocation fridgeLargeUpperModel = id("block/fridge_large_upper"); 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 0eccd7d2..c595a3d6 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 @@ -1,10 +1,7 @@ package net.blay09.mods.cookingforblockheads.fabric.datagen; import net.blay09.mods.cookingforblockheads.CookingForBlockheads; -import net.blay09.mods.cookingforblockheads.block.DyedConnectorBlock; -import net.blay09.mods.cookingforblockheads.block.ModBlocks; -import net.blay09.mods.cookingforblockheads.block.OvenBlock; -import net.blay09.mods.cookingforblockheads.block.SinkBlock; +import net.blay09.mods.cookingforblockheads.block.*; import net.blay09.mods.cookingforblockheads.item.ModItems; import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; @@ -98,7 +95,12 @@ public void generateBlockStateModels(BlockModelGenerators blockStateModelGenerat for (final var oven : ModBlocks.ovens) { createOvenBlock(blockStateModelGenerator, oven); } - blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.toaster); // TODO active state + final var toasterModel = new ResourceLocation(CookingForBlockheads.MOD_ID, "block/toaster"); + final var toasterModelActive = new ResourceLocation(CookingForBlockheads.MOD_ID, "block/toaster_active"); + blockStateModelGenerator.blockStateOutput.accept(MultiVariantGenerator.multiVariant(ModBlocks.toaster) + .with(createBooleanModelDispatch(ToasterBlock.ACTIVE, toasterModelActive, toasterModel)) + .with(createHorizontalFacingDispatch())); + blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.milkJar); blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.cowJar); blockStateModelGenerator.createNonTemplateHorizontalBlock(ModBlocks.fruitBasket);