From 1e88cc123eaa01aaa03a4d3b2b7db28a6fec96d9 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:30:38 -0600 Subject: [PATCH 1/2] bump to rc2 --- .../pfm/blocks/SimpleBunkLadderBlock.java | 2 +- .../pfm/blocks/models/ModelHelper.java | 34 ++++++--- .../models/ladder/UnbakedLadderModel.java | 74 +++++++++++++++++++ .../pfm/client/screens/MicrowaveScreen.java | 2 +- .../assets/PFMBlockstateModelProvider.java | 2 +- .../{template => }/simple_ladder.json | 0 .../{template => }/simple_ladder_top.json | 0 .../ladder/fabric/FabricLadderModel.java | 52 +++++++++++++ .../ladder/fabric/UnbakedLadderModelImpl.java | 12 +++ .../client/fabric/PFMExtraModelProvider.java | 4 + .../pfm/client/fabric/PFMModelProvider.java | 4 + .../models/ladder/forge/ForgeLadderModel.java | 44 +++++++++++ .../ladder/forge/UnbakedLadderModelImpl.java | 12 +++ .../forge/PaladinFurnitureModClientForge.java | 4 + .../pfm/mixin/forge/PFMModelLoaderMixin.java | 7 ++ gradle.properties | 2 +- 16 files changed, 239 insertions(+), 16 deletions(-) create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java rename common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/{template => }/simple_ladder.json (100%) rename common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/{template => }/simple_ladder_top.json (100%) create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/FabricLadderModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBunkLadderBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBunkLadderBlock.java index 1c688f00c..dec992199 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBunkLadderBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBunkLadderBlock.java @@ -24,7 +24,7 @@ import java.util.stream.Stream; public class SimpleBunkLadderBlock extends LadderBlock { - private static final BooleanProperty UP = Properties.UP; + public static final BooleanProperty UP = Properties.UP; private static final List SIMPLE_BUNK_LADDER = new ArrayList<>(); public SimpleBunkLadderBlock(Settings settings) { super(settings); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java index 2d48ab837..3291b28e1 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java @@ -11,6 +11,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.texture.MissingSprite; import net.minecraft.client.texture.Sprite; import net.minecraft.client.util.SpriteIdentifier; @@ -178,24 +179,33 @@ public static Identifier getTextureId(Block block, String postfix) { if (postfix.isEmpty() && !PFMDataGenerator.areAssetsRunning()) { BakedModel model = MinecraftClient.getInstance().getBakedModelManager().getBlockModels().getModel(block.getDefaultState()); if (model != null) { - id = model.getQuads(block.getDefaultState(), Direction.NORTH, new Random(42L)).get(0).getSprite().getId(); - if (id != null) { - blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); - return id; + List quadList = model.getQuads(block.getDefaultState(), Direction.NORTH, new Random(42L)); + if (!quadList.isEmpty()) { + id = quadList.get(0).getSprite().getId(); + if (id != null && id != MissingSprite.getMissingSpriteId()) { + blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); + return id; + } } } } else if (postfix.equals("top") && !PFMDataGenerator.areAssetsRunning()) { BakedModel model = MinecraftClient.getInstance().getBakedModelManager().getBlockModels().getModel(block.getDefaultState()); if (model != null) { - id = model.getQuads(block.getDefaultState(), Direction.UP, new Random(42L)).get(0).getSprite().getId(); - if (id != null && id != MissingSprite.getMissingSpriteId()) { - blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); - return id; + List quadList = model.getQuads(block.getDefaultState(), Direction.UP, new Random(42L)); + if (!quadList.isEmpty()) { + id = quadList.get(0).getSprite().getId(); + if (id != null && id != MissingSprite.getMissingSpriteId()) { + blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); + return id; + } } - id = model.getQuads(block.getDefaultState(), Direction.DOWN, new Random(42L)).get(0).getSprite().getId(); - if (id != null && id != MissingSprite.getMissingSpriteId()) { - blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); - return id; + quadList = model.getQuads(block.getDefaultState(), Direction.DOWN, new Random(42L)); + if (!quadList.isEmpty()) { + id = quadList.get(0).getSprite().getId(); + if (id != null && id != MissingSprite.getMissingSpriteId()) { + blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); + return id; + } } } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java new file mode 100644 index 000000000..845c974a1 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/UnbakedLadderModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.ladder; + +import com.mojang.datafixers.util.Pair; +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.StoneVariant; +import com.unlikepaladin.pfm.data.materials.WoodVariant; +import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.client.render.model.ModelLoader; +import net.minecraft.client.render.model.UnbakedModel; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; + +public class UnbakedLadderModel implements UnbakedModel { + public static final Identifier[] LADDER_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bunk_ladder/simple_ladder"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bunk_ladder/simple_ladder_top") + }; + + public static final Identifier LADDER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bunk_ladder"); + public static final List LADDER_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_bunk_ladder")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_simple_bunk_ladder")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_bunk_ladder")); + } + add(LADDER_MODEL_ID); + } + }; + + private static final Identifier PARENT = new Identifier("block/block"); + public Collection getModelDependencies() { + return List.of(PARENT); + } + + @Override + public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { + return Collections.emptyList(); + } + + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); + @Nullable + @Override + public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { + if (CACHED_MODELS.containsKey(rotationContainer)) + return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + + List bakedModelList = new ArrayList<>(); + for (Identifier modelPart : LADDER_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); + } + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); + } + + @ExpectPlatform + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + throw new RuntimeException("Method wasn't replaced correctly"); + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/MicrowaveScreen.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/MicrowaveScreen.java index 417d73b4b..8c712df32 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/screens/MicrowaveScreen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/MicrowaveScreen.java @@ -86,7 +86,7 @@ protected void handledScreenTick() { super.handledScreenTick(); this.isActive = handler.isActive; DefaultedList inventory = DefaultedList.ofSize(1,handler.getInventory().getStack(0)); - Recipe recipe = getRecipe(Objects.requireNonNull(handler.microwaveBlockEntity.getWorld()), handler.getInventory()); + Recipe recipe = getRecipe(handler.microwaveBlockEntity.getWorld(), handler.getInventory()); if(!MicrowaveBlockEntity.canAcceptRecipeOutput(recipe, inventory ,microwaveBlockEntity.getMaxCountPerStack()) && !this.handler.isActive()) { this.startButton.active = false; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java index 203dc7faa..d1d0ccdc9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMBlockstateModelProvider.java @@ -184,7 +184,7 @@ public void registerBeds() { } public void registerLadders() { - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleBunkLadderBlock.class).getVariantToBlockMap(), "simple_bunk_ladder", TEMPLATE_SIMPLE_BUNK_LADDER_ARRAY, PFMBlockStateModelGenerator::createLadderBlockState, PFMBlockStateModelGenerator::createPlankBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleBunkLadderBlock.class).getVariantToBlockMap(), "simple_bunk_ladder", PFMBlockStateModelGenerator::createOrientableTableBlockState); } public void registerCounters() { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/template/simple_ladder.json b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json similarity index 100% rename from common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/template/simple_ladder.json rename to common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/template/simple_ladder_top.json b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json similarity index 100% rename from common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/template/simple_ladder_top.json rename to common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/FabricLadderModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/FabricLadderModel.java new file mode 100644 index 000000000..3f57959c0 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/FabricLadderModel.java @@ -0,0 +1,52 @@ +package com.unlikepaladin.pfm.blocks.models.ladder.fabric; + +import com.unlikepaladin.pfm.blocks.SimpleBunkLadderBlock; +import com.unlikepaladin.pfm.blocks.models.fabric.PFMFabricBakedModel; +import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; +import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.client.texture.Sprite; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.BlockRenderView; + +import java.util.List; +import java.util.Random; +import java.util.function.Supplier; + +public class FabricLadderModel extends PFMFabricBakedModel { + public FabricLadderModel(ModelBakeSettings settings, List bakedModels) { + super(settings, bakedModels); + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } + + @Override + public boolean isVanillaAdapter() { + return false; + } + + @Override + public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + if (state != null && state.getBlock() instanceof SimpleBunkLadderBlock) { + Sprite sprite = getSpriteList(state).get(0); + pushTextureTransform(context, sprite); + int offset = state.get(SimpleBunkLadderBlock.UP) ? 1 : 0; + ((FabricBakedModel)getTemplateBakedModels().get(offset)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + Sprite sprite = getSpriteList(stack).get(0); + pushTextureTransform(context, sprite); + ((FabricBakedModel)getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java new file mode 100644 index 000000000..0f30d9109 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/fabric/UnbakedLadderModelImpl.java @@ -0,0 +1,12 @@ +package com.unlikepaladin.pfm.blocks.models.ladder.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; + +public class UnbakedLadderModelImpl { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + return new FabricLadderModel(settings, modelParts); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMExtraModelProvider.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMExtraModelProvider.java index 816544fe3..78aa6cb08 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMExtraModelProvider.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMExtraModelProvider.java @@ -22,6 +22,7 @@ import com.unlikepaladin.pfm.blocks.models.kitchenSink.UnbakedKitchenSinkModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; +import com.unlikepaladin.pfm.blocks.models.ladder.UnbakedLadderModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -106,6 +107,9 @@ public void provideExtraModels(ResourceManager manager, Consumer out for (Identifier id : UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_PARTS_BASE) { out.accept(id); } + for (Identifier id : UnbakedLadderModel.LADDER_PARTS_BASE) { + out.accept(id); + } UnbakedMirrorModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedIronFridgeModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedFridgeModel.ALL_MODEL_IDS.forEach(out::accept); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelProvider.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelProvider.java index 9ef0ec10d..f77bfbb5d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelProvider.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMModelProvider.java @@ -23,6 +23,7 @@ import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; +import com.unlikepaladin.pfm.blocks.models.ladder.UnbakedLadderModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -123,6 +124,9 @@ else if (UnbakedFreezerModel.FREEZER_MODEL_IDS.contains(resourceId)){ else if (UnbakedBasicLampModel.LAMP_MODEL_IDS.contains(resourceId)){ return new UnbakedBasicLampModel(); } + else if (UnbakedLadderModel.LADDER_MODEL_IDS.contains(resourceId)){ + return new UnbakedLadderModel(); + } else return null; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java new file mode 100644 index 000000000..59fca0f69 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java @@ -0,0 +1,44 @@ +package com.unlikepaladin.pfm.blocks.models.ladder.forge; + +import com.unlikepaladin.pfm.blocks.SimpleBunkLadderBlock; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.BakedQuad; +import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.client.texture.Sprite; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; +import net.minecraftforge.client.model.data.IModelData; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeLadderModel extends PFMForgeBakedModel { + + public ForgeLadderModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && state.getBlock() instanceof SimpleBunkLadderBlock) { + int offset = state.get(SimpleBunkLadderBlock.UP) ? 1 : 0; + Sprite sprite = getSpriteList(state).get(0); + return getQuadsWithTexture(getTemplateBakedModels().get(offset).getQuads(state, side, rand, extraData), sprite); + } + return Collections.emptyList(); + } + + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + Sprite sprite = getSpriteList(stack).get(0); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), sprite); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java new file mode 100644 index 000000000..d61375a67 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/UnbakedLadderModelImpl.java @@ -0,0 +1,12 @@ +package com.unlikepaladin.pfm.blocks.models.ladder.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; + +public class UnbakedLadderModelImpl { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + return new ForgeLadderModel(settings, modelParts); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java index b78a42399..a42393704 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java @@ -22,6 +22,7 @@ import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; +import com.unlikepaladin.pfm.blocks.models.ladder.UnbakedLadderModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -147,6 +148,9 @@ public static void registerExtraModels(ModelRegistryEvent event) { for (Identifier id : UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_PARTS_BASE) { ModelLoader.addSpecialModel(id); } + for (Identifier id : UnbakedLadderModel.LADDER_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } UnbakedMirrorModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedIronFridgeModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedFridgeModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMModelLoaderMixin.java b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMModelLoaderMixin.java index 23ca4a6ce..a8d744a81 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMModelLoaderMixin.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMModelLoaderMixin.java @@ -23,6 +23,7 @@ import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; +import com.unlikepaladin.pfm.blocks.models.ladder.UnbakedLadderModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -226,5 +227,11 @@ else if (UnbakedLogStoolModel.LOG_STOOL_MODEL_IDS.contains(modifiedId)){ this.modelsToBake.put(resourceId, model); ci.cancel(); } + else if (UnbakedLadderModel.LADDER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedLadderModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 866e60cbf..83e7e8d10 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.17.1 enabled_platforms=fabric,forge archives_base_name=paladin-furniture-mod -mod_version=1.2.1 +mod_version=1.2.1-rc2 maven_group=com.unlikepaladin architectury_version=2.10.12 From 2800085e53452fd486dc679cd97973c5ed9b4ee1 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:45:24 -0600 Subject: [PATCH 2/2] fix missing particles on ladder blocks --- .../pfm/models/block/simple_bunk_ladder/simple_ladder.json | 4 ++-- .../models/block/simple_bunk_ladder/simple_ladder_top.json | 4 ++-- .../pfm/blocks/models/ladder/forge/ForgeLadderModel.java | 7 +++++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json index 5ea44ba92..eae66e1c5 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture", - "particle": "#texture" + "0": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json index 7fdddeb82..9c4bbf5b9 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bunk_ladder/simple_ladder_top.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture", - "particle": "#texture" + "0": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java index 59fca0f69..523cfefa9 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/ladder/forge/ForgeLadderModel.java @@ -8,8 +8,11 @@ import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.world.BlockRenderView; import net.minecraftforge.client.model.data.IModelData; +import net.minecraftforge.client.model.data.ModelDataMap; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -35,6 +38,10 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction return Collections.emptyList(); } + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + return super.getModelData(world, pos, state, new ModelDataMap.Builder().build()); + } @Override public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) {