From 8aad53f695f259d7c084b84cb90b0454553340e7 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Wed, 20 Dec 2023 23:17:34 -0600 Subject: [PATCH 01/10] New Fancy model system, transforms Model geometry uvs on the fly, currently implemented for all tables, and the nightstand also made comments look nicer/consistent --- .../pfm/blocks/ClassicTableBlock.java | 2 +- .../pfm/blocks/LogTableBlock.java | 2 +- .../pfm/blocks/models/AbstractBakedModel.java | 107 ++++++++-- .../pfm/blocks/models/ModelHelper.java | 21 +- .../basicTable/UnbakedBasicTableModel.java | 114 ++++------- .../UnbakedClassicNightstandModel.java | 91 +++------ .../UnbakedClassicTableModel.java | 126 +++++------- .../dinnerTable/UnbakedDinnerTableModel.java | 80 +++----- .../models/logTable/UnbakedLogTableModel.java | 111 +++-------- .../UnbakedModernDinnerTableModel.java | 82 +++----- .../pfm/client/screens/StoveScreen.java | 2 +- .../data/materials/DynamicBlockRegistry.java | 2 +- .../pfm/data/materials/VariantBase.java | 8 +- .../data/materials/VariantRegistryBase.java | 4 +- .../data/materials/WoodVariantRegistry.java | 10 +- .../pfm/entity/render/SkinGetter.java | 2 +- .../menus/AbstractMicrowaveScreenHandler.java | 4 +- .../pfm/menus/WorkbenchScreenHandler.java | 6 +- .../assets/PFMBlockstateModelProvider.java | 50 +++-- .../classic_nightstand.json | 6 +- .../classic_nightstand_left.json | 6 +- .../classic_nightstand_left_open.json | 6 +- .../classic_nightstand_middle.json | 6 +- .../classic_nightstand_middle_open.json | 6 +- .../classic_nightstand_open.json | 6 +- .../classic_nightstand_right.json | 6 +- .../classic_nightstand_right_open.json | 6 +- .../block/dinner_table/dinner_table.json | 6 +- .../block/dinner_table/dinner_table_left.json | 22 +- .../block/dinner_table/dinner_table_legs.json | 117 +++++++++++ .../dinner_table/dinner_table_middle.json | 8 +- .../dinner_table/dinner_table_right.json | 22 +- .../pfm/models/block/log_table/log_table.json | 14 +- .../block/log_table/log_table_left.json | 8 +- .../block/log_table/log_table_legs.json | 91 +++++++++ .../block/log_table/log_table_middle.json | 8 +- .../block/log_table/log_table_right.json | 8 +- .../models/block/table_basic/table_basic.json | 6 +- .../block/table_basic/table_basic_base.json | 9 +- .../table_basic_east_west_north.json | 6 +- .../table_basic_east_west_south.json | 6 +- .../table_basic/table_basic_north_east.json | 6 +- .../table_basic_north_east_corner.json | 6 +- .../table_basic_north_south_east.json | 6 +- .../table_basic_north_south_east_bottom.json | 6 +- .../table_basic_north_south_east_top.json | 6 +- .../table_basic_north_south_west.json | 6 +- .../table_basic_north_south_west_bottom.json | 6 +- .../table_basic_north_south_west_top.json | 6 +- .../table_basic/table_basic_north_west.json | 6 +- .../table_basic_north_west_corner.json | 6 +- .../table_basic/table_basic_south_east.json | 6 +- .../table_basic_south_east_corner.json | 6 +- .../table_basic/table_basic_south_west.json | 6 +- .../table_basic_south_west_corner.json | 6 +- .../block/table_classic/table_classic.json | 6 +- .../table_classic/table_classic_middle.json | 8 +- .../table_classic/table_classic_one.json | 4 +- .../table_classic/table_classic_one_uved.json | 4 +- .../table_classic/table_classic_two.json | 2 +- .../table_classic/table_classic_two_uved.json | 4 +- .../table_modern_dinner.json | 6 +- .../table_modern_dinner_base.json | 86 ++++++++ .../table_modern_dinner_left.json | 22 +- .../table_modern_dinner_legs.json | 188 ++++++++++++++++++ .../table_modern_dinner_middle.json | 22 +- .../table_modern_dinner_right.json | 22 +- .../blocks/fabric/InnerTrashcanBlockImpl.java | 2 +- .../pfm/blocks/fabric/MicrowaveBlockImpl.java | 2 +- .../pfm/blocks/fabric/StoveBlockImpl.java | 2 +- .../pfm/blocks/fabric/TrashcanBlockImpl.java | 2 +- .../fabric/FabricBasicLampModel.java | 2 +- .../fabric/FabricBasicTableModel.java | 127 +++++++----- .../fabric/UnbakedBasicTableModelImpl.java | 11 +- .../models/bed/fabric/FabricBedModel.java | 32 +-- .../fabric/FabricClassicNightstandModel.java | 29 ++- .../UnbakedClassicNightstandModelImpl.java | 10 +- .../fabric/FabricClassicTableModel.java | 39 +++- .../fabric/UnbakedClassicTableModelImpl.java | 11 +- .../fabric/FabricDinnerTableModel.java | 39 +++- .../fabric/UnbakedDinnerTableModelImpl.java | 11 +- .../models/fabric/PFMFabricBakedModel.java | 56 ++++++ .../fridge/fabric/FabricFreezerModel.java | 14 +- .../fridge/fabric/FabricFridgeModel.java | 22 +- .../fridge/fabric/FabricIronFridgeModel.java | 20 +- .../fabric/FabricKitchenCabinetModel.java | 22 +- .../fabric/FabricKitchenCounterModel.java | 28 +-- .../fabric/FabricKitchenCounterOvenModel.java | 14 +- .../fabric/FabricKitchenDrawerModel.java | 26 ++- .../fabric/FabricKitchenWallCounterModel.java | 24 ++- .../fabric/FabricKitchenWallDrawerModel.java | 24 ++- .../logTable/fabric/FabricLogTableModel.java | 39 +++- .../fabric/UnbakedLogTableModelImpl.java | 11 +- .../mirror/fabric/FabricMirrorModel.java | 32 +-- .../fabric/FabricModernDinnerTableModel.java | 40 +++- .../UnbakedModernDinnerTableModelImpl.java | 11 +- .../PFMBakedModelParticleExtension.java | 8 + .../client/fabric/PFMExtraModelProvider.java | 25 ++- .../pfm/client/fabric/PFMModelProvider.java | 24 +-- .../fabric/shape/BlockPortalShape.java | 12 +- .../pfm/fabric/PaladinFurnitureModFabric.java | 6 +- .../pfm/mixin/fabric/PFMBlockModelsMixin.java | 25 +++ .../mixin/fabric/PFMCrackParticleMixin.java | 33 +++ fabric/src/main/resources/pfm.mixins.json | 6 +- .../pfm/blocks/forge/StoveBlockImpl.java | 2 +- .../basicLamp/forge/ForgeBasicLampModel.java | 2 +- .../forge/ForgeBasicTableModel.java | 146 +++++++++----- .../forge/UnbakedBasicTableModelImpl.java | 11 +- .../models/bed/forge/ForgeBedModel.java | 27 +-- .../forge/ForgeClassicNightstandModel.java | 49 +++-- .../UnbakedClassicNightstandModelImpl.java | 11 +- .../forge/ForgeClassicTableModel.java | 66 ++++-- .../forge/UnbakedClassicTableModelImpl.java | 11 +- .../forge/ForgeDinnerTableModel.java | 57 ++++-- .../forge/UnbakedDinnerTableModelImpl.java | 11 +- .../models/forge/PFMForgeBakedModel.java | 148 ++++++++++++++ .../fridge/forge/ForgeFreezerModel.java | 9 +- .../models/fridge/forge/ForgeFridgeModel.java | 17 +- .../fridge/forge/ForgeIronFridgeModel.java | 15 +- .../forge/ForgeKitchenCabinetModel.java | 15 +- .../forge/ForgeKitchenCounterModel.java | 25 ++- .../forge/UnbakedKitchenCounterModelImpl.java | 2 +- .../forge/ForgeKitchenCounterOvenModel.java | 9 +- .../forge/ForgeKitchenDrawerModel.java | 21 +- .../forge/ForgeKitchenWallCounterModel.java | 19 +- .../forge/ForgeKitchenWallDrawerModel.java | 19 +- .../logTable/forge/ForgeLogTableModel.java | 57 ++++-- .../forge/UnbakedLogTableModelImpl.java | 11 +- .../models/mirror/forge/ForgeMirrorModel.java | 23 ++- .../forge/ForgeModernDinnerTableModel.java | 58 ++++-- .../UnbakedModernDinnerTableModelImpl.java | 11 +- .../forge/PFMBakedModelGetQuadsExtension.java | 15 ++ .../pfm/client/forge/PFMItemRenderer.java | 1 - .../forge/PaladinFurnitureModClientForge.java | 26 ++- .../imm_ptl/forge/shape/BlockPortalShape.java | 12 +- .../pfm/mixin/forge/ItemRendererMixin.java | 65 ++++++ .../pfm/mixin/forge/PFMModelLoaderMixin.java | 59 +++--- .../registry/forge/NetworkRegistryForge.java | 2 +- .../registry/forge/RecipeRegistryForge.java | 4 +- forge/src/main/resources/pfm.mixins.json | 1 + 140 files changed, 2322 insertions(+), 1217 deletions(-) create mode 100644 common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_legs.json create mode 100644 common/src/main/resources/assets/pfm/models/block/log_table/log_table_legs.json create mode 100644 common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_base.json create mode 100644 common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_legs.json create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMBlockModelsMixin.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/ItemRendererMixin.java diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/ClassicTableBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/ClassicTableBlock.java index 1f25373d2..42aa521f4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/ClassicTableBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/ClassicTableBlock.java @@ -107,7 +107,7 @@ public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape sh final static VoxelShape TABLE_CLASSIC_SOUTH_WEST_LEG = createCuboidShape(2, 0, 12, 4, 15, 14); final static VoxelShape TABLE_CLASSIC_SOUTH_EAST_LEG = createCuboidShape(12, 0, 12, 14, 15, 14); - //Cursed I know + // Cursed I know final static Map VOXEL_SHAPES = new HashMap<>(); public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/LogTableBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/LogTableBlock.java index a016fdaa6..bc5db6ce0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/LogTableBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/LogTableBlock.java @@ -127,7 +127,7 @@ public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape sh final static VoxelShape LOG_TABLE_ONE_SOUTH = rotateShape(Direction.NORTH, Direction.SOUTH, LOG_TABLE_ONE); final static VoxelShape LOG_TABLE_ONE_EAST = rotateShape(Direction.NORTH, Direction.EAST, LOG_TABLE_ONE); final static VoxelShape LOG_TABLE_EAST = rotateShape(Direction.NORTH, Direction.EAST, LOG_TABLE); - //Cursed I know + // Cursed I know public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) { Direction dir = state.get(FACING); boolean left = isTable(view, pos, dir.rotateYCounterclockwise(), dir); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 6311716cc..899c5f084 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -1,5 +1,9 @@ package com.unlikepaladin.pfm.blocks.models; +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.VariantBase; +import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; @@ -7,26 +11,25 @@ import net.minecraft.client.render.model.json.ModelOverrideList; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.math.Direction; import org.jetbrains.annotations.Nullable; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Random; +import java.util.*; public abstract class AbstractBakedModel implements BakedModel { protected final ModelBakeSettings settings; - private final Sprite frame; - private final Map bakedModels; - public AbstractBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels) { - this.frame = frame; + private final List templateBakedModels; + public AbstractBakedModel(ModelBakeSettings settings, List templateBakedModels) { this.settings = settings; - this.bakedModels = bakedModels; + this.templateBakedModels = templateBakedModels; } - public Map getBakedModels() { - return bakedModels; + public List getTemplateBakedModels() { + return templateBakedModels; } @Override @@ -54,18 +57,88 @@ public boolean isBuiltin() { return false; } - @Override - public Sprite getParticleSprite() { - return frame; - } - @Override public ModelTransformation getTransformation() { - return ModelTransformation.NONE; + return templateBakedModels.get(0).getTransformation(); } @Override public ModelOverrideList getOverrides() { return ModelOverrideList.EMPTY; } + + Map> blockVariantMap = new HashMap<>(); + protected VariantBase getVariant(BlockState state) { + VariantBase variant; + if (blockVariantMap.containsKey(state.getBlock())) { + variant = blockVariantMap.get(state.getBlock()); + } else { + variant = PaladinFurnitureModBlocksItems.furnitureEntryMap.get(state.getBlock().getClass()).getVariantFromEntry(state.getBlock()); + blockVariantMap.put(state.getBlock(), variant); + } + return variant; + } + + + private final Map blockItemBlockStateMap = new HashMap<>(); + /** + Accepts an ItemStack, a BlockState, a Block or a BlockItem + */ + public List getSpriteList(T element) { + if (element instanceof BlockState) { + BlockState state = (BlockState) element; + return getSpriteFromState(state); + } + else if (element instanceof BlockItem) { + BlockItem blockItem = (BlockItem) element; + if (blockItemBlockStateMap.containsKey(blockItem)) + return getSpriteFromState(blockItemBlockStateMap.get(blockItem)); + + BlockState state = blockItem.getBlock().getDefaultState(); + blockItemBlockStateMap.put(blockItem, state); + return getSpriteFromState(state); + } else if (element instanceof Block) { + Block block = (Block) element; + if (spriteList.containsKey(block)) + return spriteList.get(block); + + BlockState state = block.getDefaultState(); + return getSpriteFromState(state); + } else if (element instanceof ItemStack && ((ItemStack) element).getItem() instanceof BlockItem) { + BlockItem blockItem = (BlockItem)((ItemStack) element).getItem(); + if (blockItemBlockStateMap.containsKey(blockItem)) + return getSpriteFromState(blockItemBlockStateMap.get(blockItem)); + + BlockState state = blockItem.getBlock().getDefaultState(); + blockItemBlockStateMap.put(blockItem, state); + return getSpriteFromState(state); + } else if (element == null) { + return Collections.singletonList(getTemplateBakedModels().get(0).getParticleSprite()); + } else { + PaladinFurnitureMod.GENERAL_LOGGER.error("Invalid element for sprite list method"); + } + return Collections.singletonList(getTemplateBakedModels().get(0).getParticleSprite()); + } + + private final Map> spriteList = new HashMap<>(); + private List getSpriteFromState(BlockState state) { + if (spriteList.containsKey(state.getBlock())) + return spriteList.get(state.getBlock()); + + VariantBase variant = getVariant(state); + boolean stripped = state.getBlock().getTranslationKey().contains("stripped"); + List list = new ArrayList<>(3); + if (!state.getBlock().getTranslationKey().contains("_raw_")) { + SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId((Block) variant.getChild("stripped_log"))) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getBaseBlock())); + SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getBaseBlock())) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getSecondaryBlock())); + list.add(mainTexture.getSprite()); + list.add(secondTexture.getSprite()); + } else { + SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId((Block) variant.getChild("stripped_log"))) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getSecondaryBlock())); + list.add(mainTexture.getSprite()); + list.add(mainTexture.getSprite()); + } + spriteList.put(state.getBlock(), list); + return list; + } } \ No newline at end of file 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 7c8592ea6..535164fd1 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 @@ -7,9 +7,14 @@ import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.block.Block; import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.texture.Sprite; +import net.minecraft.client.texture.SpriteAtlasTexture; +import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.data.client.model.Texture; import net.minecraft.resource.ResourcePack; import net.minecraft.resource.ResourceType; +import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; import net.minecraft.util.Pair; @@ -17,12 +22,20 @@ import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; +import java.util.*; import java.util.concurrent.atomic.AtomicBoolean; public class ModelHelper { + private static final List OAK_SPRITES_TO_REPLACE = new ArrayList<>(); + public static List getOakSprites() { + if (OAK_SPRITES_TO_REPLACE.isEmpty()) { + SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.PLANKS)); + SpriteIdentifier logId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.LOG)); + OAK_SPRITES_TO_REPLACE.add(planksId.getSprite()); + OAK_SPRITES_TO_REPLACE.add(logId.getSprite()); + } + return OAK_SPRITES_TO_REPLACE; + } public static boolean containsIdentifier(Identifier[] modelIds, Identifier comparison) { AtomicBoolean contains = new AtomicBoolean(false); Arrays.stream(modelIds).forEach(identifier -> { @@ -182,7 +195,7 @@ else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLo return id; } - //For compatibility with Twilight Forest's Planks + // For compatibility with Twilight Forest's Planks public static Identifier getPlankId(Block block) { Identifier identifier = Registry.BLOCK.getId(block); String namespace = identifier.getNamespace(); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java index 6c21757ca..ae8f3b3bd 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/UnbakedBasicTableModel.java @@ -6,118 +6,80 @@ import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -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.render.model.*; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.Identifier; +import net.minecraft.util.math.AffineTransformation; import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedBasicTableModel implements UnbakedModel { - public static final List BASIC_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/table_basic/template_table_basic/template_table_basic_base"); - add("block/table_basic/template_table_basic/template_table_basic_north_east"); - add("block/table_basic/template_table_basic/template_table_basic_north_west"); - add("block/table_basic/template_table_basic/template_table_basic_south_east"); - add("block/table_basic/template_table_basic/template_table_basic_south_west"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_east_top"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_west_top"); - add("block/table_basic/template_table_basic/template_table_basic_east_west_north"); - add("block/table_basic/template_table_basic/template_table_basic_east_west_south"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_east_bottom"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_west_bottom"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_east"); - add("block/table_basic/template_table_basic/template_table_basic_north_south_west"); - add("block/table_basic/template_table_basic/template_table_basic_north_east_corner"); - add("block/table_basic/template_table_basic/template_table_basic_north_west_corner"); - add("block/table_basic/template_table_basic/template_table_basic_south_east_corner"); - add("block/table_basic/template_table_basic/template_table_basic_south_west_corner"); - } + public static final Identifier[] BASIC_MODEL_PARTS_BASE = { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_base"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_east"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_west"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_south_east"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_south_west"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_east_top"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_west_top"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_east_west_north"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_east_west_south"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_east_bottom"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_west_bottom"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_east"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_south_west"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_east_corner"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_north_west_corner"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_south_east_corner"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/table_basic_south_west_corner") }; - private static final Identifier PARENT = new Identifier("block/block"); - public static final List TABLE_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/stripped_" + variant.asString() + "_table_basic")); - } - for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic/" + variant.asString() + "_table_basic")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { + public static final Identifier TABLE_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_basic"); + public static final List MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : BASIC_MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_basic")); if (variant.hasStripped()) - for (String part : BASIC_MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_basic")); } for(StoneVariant variant : StoneVariant.values()){ - for (String part : BASIC_MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_basic")); } + add(TABLE_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedBasicTableModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : BASIC_MODEL_PARTS_BASE){ - String s = modelPartName; - s = s.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); } @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + if (CACHED_MODELS.containsKey(rotationContainer)) + return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + + List bakedModelList = new ArrayList<>(); + for (Identifier modelPart : BASIC_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + 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/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java index e9f6292bc..61747c162 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/UnbakedClassicNightstandModel.java @@ -15,74 +15,35 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; public class UnbakedClassicNightstandModel implements UnbakedModel { - public static final List NIGHTSTAND_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_middle"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_right"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_left"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_middle_open"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_right_open"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_left_open"); - add("block/classic_nightstand/template_classic_nightstand/template_classic_nightstand_open"); - - } + public static final Identifier[] NIGHTSTAND_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_middle_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_right_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_left_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/classic_nightstand_open") }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedClassicNightstandModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - - for(String modelPartName : NIGHTSTAND_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } + public static final Identifier NIGHTSTAND_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand"); public static final List NIGHSTAND_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/" + variant.asString() + "_classic_nightstand")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_nightstand")); if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/stripped_" + variant.asString() + "_classic_nightstand")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_classic_nightstand")); } for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_nightstand/" + variant.asString() + "_classic_nightstand")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - - for (String part : NIGHTSTAND_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) - for (String part : NIGHTSTAND_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(StoneVariant variant : StoneVariant.values()){ - - for (String part : NIGHTSTAND_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_nightstand")); } + add(NIGHTSTAND_MODEL_ID); } }; @@ -93,24 +54,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(1); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : NIGHTSTAND_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + 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/blocks/models/classicTable/UnbakedClassicTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java index f84c669b3..316cc30a5 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/UnbakedClassicTableModel.java @@ -17,96 +17,62 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedClassicTableModel implements UnbakedModel { - public static final List CLASSIC_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/table_classic/template_table_classic/template_table_classic_middle"); - add("block/table_classic/template_table_classic/template_table_classic_two"); - add("block/table_classic/template_table_classic/template_table_classic_two_uved"); - add("block/table_classic/template_table_classic/template_table_classic_one"); - add("block/table_classic/template_table_classic/template_table_classic_one_uved"); - add("block/table_classic/template_table_classic/template_table_classic"); - } -} ; - - private static final Identifier PARENT = new Identifier("block/block"); - public static final List TABLE_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/stripped_" + variant.asString() + "_table_classic")); - } - for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/" + variant.asString() + "_table_classic")); - } - } - }; + public static final Identifier[] CLASSIC_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic_two"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic_two_uved"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic_one"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic_one_uved"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic/table_classic") + }; - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : CLASSIC_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) - for (String part : CLASSIC_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(StoneVariant variant : StoneVariant.values()){ - - for (String part : CLASSIC_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier TABLE_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_classic"); + public static final List MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_classic")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_classic")); } - }; - - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedClassicTableModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : CLASSIC_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); + for(StoneVariant variant : StoneVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_classic")); } - this.MODEL_PARTS = modelParts; + add(TABLE_MODEL_ID); } + }; - @Override - public Collection getModelDependencies() { - return List.of(PARENT); - } - @Override - public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; - } + @Override + public Collection getModelDependencies() { + return List.of(PARENT); + } + @Override + public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { + return Collections.emptyList(); + } - @Nullable - @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); - } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); - } + 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)); - @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - throw new RuntimeException("Method wasn't replaced correctly"); + List bakedModelList = new ArrayList<>(); + for (Identifier modelPart : CLASSIC_MODEL_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"); + } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java index 5b0e70d5b..d3bb35e3e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/UnbakedDinnerTableModel.java @@ -16,70 +16,34 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedDinnerTableModel implements UnbakedModel { - public static final List DINNER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/dinner_table/template_dinner_table/template_dinner_table_middle"); - add("block/dinner_table/template_dinner_table/template_dinner_table_right"); - add("block/dinner_table/template_dinner_table/template_dinner_table_left"); - add("block/dinner_table/template_dinner_table/template_dinner_table"); - } + public static final Identifier[] DINNER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/dinner_table_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/dinner_table_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/dinner_table_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/dinner_table_legs") }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier TABLE_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table"); public static final List TABLE_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_dinner")); if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/stripped_" + variant.asString() + "_dinner_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_dinner")); } for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/dinner_table/" + variant.asString() + "_dinner_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_dinner")); } + add(TABLE_MODEL_ID); } }; - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) - for (String part : DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(StoneVariant variant : StoneVariant.values()){ - for (String part : DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - } - }; - - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedDinnerTableModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : DINNER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -87,24 +51,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : DINNER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java index a610e4322..5fb44fda1 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/UnbakedLogTableModel.java @@ -16,101 +16,38 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedLogTableModel implements UnbakedModel { - public static final List LOG_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/log_table/template_log_table/template_log_table_middle"); - add("block/log_table/template_log_table/template_log_table_right"); - add("block/log_table/template_log_table/template_log_table_left"); - add("block/log_table/template_log_table/template_log_table"); - } + public static final Identifier[] LOG_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/log_table_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/log_table_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/log_table_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/log_table_legs") }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier TABLE_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table"); public static final List TABLE_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ String logType = variant.isNetherWood() ? "stem" : "log"; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_" + logType+ "_table")); - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_raw_" + logType+ "_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_" + logType)); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_raw_table_" + logType)); if (variant.hasStripped()) { - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_" + logType+ "_table")); - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/stripped_" + variant.asString() + "_raw_" + logType+ "_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_" + logType)); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_raw_table_" + logType)); } } for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_table/" + variant.asString() + "_natural_table")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_natural")); } + add(TABLE_MODEL_ID); } }; - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_log", variant.asString() + "_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString() + "_raw"); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) { - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString() + "_raw"); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - if (variant.isNetherWood()) - newPart = newPart.replace(variant.asString() + "_log", variant.asString() + "_stem"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - } - for(StoneVariant variant : StoneVariant.values()){ - for (String part : LOG_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()).replace(variant.asString() + "_log", variant.asString() +"_natural"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - } - }; - - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedLogTableModel(VariantBase variant, List modelParts, BlockType type, boolean raw) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : LOG_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - if (raw) { - s = s.replace(variant.asString() + "_log", variant.asString() + "_raw_log"); - if (variant.isNetherWood()) - s = s.replace(variant.asString() + "_raw_log", variant.asString() + "_raw_stem"); - } - if (variant instanceof StoneVariant) { - s = s.replace(variant.asString() + "_log", variant.asString() + "_natural"); - } else if(variant.isNetherWood()) { - s = s.replace(variant.asString() + "_log", variant.asString() + "_stem"); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -118,24 +55,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : LOG_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java index 79f1f596a..823f30513 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/UnbakedModernDinnerTableModel.java @@ -16,70 +16,36 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedModernDinnerTableModel implements UnbakedModel { - public static final List MODERN_DINNER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/table_modern_dinner/template_table_modern_dinner/template_table_modern_dinner_middle"); - add("block/table_modern_dinner/template_table_modern_dinner/template_table_modern_dinner_right"); - add("block/table_modern_dinner/template_table_modern_dinner/template_table_modern_dinner_left"); - add("block/table_modern_dinner/template_table_modern_dinner/template_table_modern_dinner"); - } + public static final Identifier[] MODERN_DINNER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/table_modern_dinner_base"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/table_modern_dinner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/table_modern_dinner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/table_modern_dinner_legs"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/table_modern_dinner_middle"), }; + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier TABLE_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/modern_dinner_table"); public static final List TABLE_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/" + variant.asString() + "_table_modern_dinner")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/stripped_" + variant.asString() + "_table_modern_dinner")); - } - for(StoneVariant variant : StoneVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/table_modern_dinner/" + variant.asString() + "_table_modern_dinner")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_modern_dinner")); if (variant.hasStripped()) - for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_table_modern_dinner")); } for(StoneVariant variant : StoneVariant.values()){ - for (String part : MODERN_DINNER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_table_modern_dinner")); } + add(TABLE_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedModernDinnerTableModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : MODERN_DINNER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -87,24 +53,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : MODERN_DINNER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/screens/StoveScreen.java b/common/src/main/java/com/unlikepaladin/pfm/client/screens/StoveScreen.java index b68d24a3a..c6d551f8c 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/screens/StoveScreen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/screens/StoveScreen.java @@ -8,7 +8,7 @@ import net.minecraft.util.Identifier; public class StoveScreen extends AbstractFurnaceScreen { - //You can replace the background with whatever you like, just remember there will always be the recipe book button + // You can replace the background with whatever you like, just remember there will always be the recipe book button private static final Identifier BACKGROUND = new Identifier("textures/gui/container/smoker.png"); public StoveScreen(StoveScreenHandler handler, PlayerInventory inventory, Text title) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java index 6fff2ac43..c51b7bc7c 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java @@ -75,7 +75,7 @@ public static void compatInit() { emburOld.addChild("slab", "embur_slab"); addBlockTypeFinder(WoodVariant.class, emburOld); - //mcreator mod with typos... + // mcreator mod with typos... addBlockTypeFinder(WoodVariant.class, WoodVariant.Finder.simple( "nethers_exoticism", "jabuticaba", "jaboticaba_planks", "jabuticaba_log")); diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantBase.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantBase.java index 37c100ee4..6612b1210 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantBase.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantBase.java @@ -141,11 +141,11 @@ public static Object changeType(Object current, VariantBase originalMat, Vari return null; } - //for items + // for items @Nullable public static Item changeItemType(Item current, VariantBase originalMat, VariantBase destinationMat) { Object changed = changeType(current, originalMat, destinationMat); - //if item swap fails try to swap blocks instead + // if item swap fails try to swap blocks instead if (changed == null) { if (current instanceof BlockItem bi) { var blockChanged = changeType(bi.getBlock(), originalMat, destinationMat); @@ -159,11 +159,11 @@ public static Item changeItemType(Item current, VariantBase originalMat, Vari return null; } - //for blocks + // for blocks @Nullable public static Block changeBlockType(@NotNull Block current, VariantBase originalMat, VariantBase destinationMat) { Object changed = changeType(current, originalMat, destinationMat); - //if block swap fails try to swap items instead + // if block swap fails try to swap items instead if (changed == null) { if (current.asItem() != Items.AIR) { var itemChanged = changeType(current.asItem(), originalMat, destinationMat); diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java index 0a6cf6850..188196cb4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java @@ -48,9 +48,9 @@ public void registerBlockType(T newType) { public abstract Optional getVariantFromBlock(Block baseBlock, Identifier blockId); public void buildAll() { - //adds default + // adds default this.registerBlockType(this.getDefaultType()); - //adds finders + // adds finders finders.stream().map(VariantBase.SetFinder::get).forEach(f -> f.ifPresent(this::registerBlockType)); for (Block block : Registry.BLOCK) { this.getVariantFromBlock(block, Registry.BLOCK.getId(block)).ifPresent(this::registerBlockType); diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java index 5ef43ca23..cc92dca50 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariantRegistry.java @@ -63,14 +63,14 @@ public Optional getVariantFromBlock(Block baseBlock, Identifier blo !namespace.equals("absentbydesign") && !(namespace.equals("terrestria") && path.contains("sakura")) && !(namespace.equals("betternether") && path.contains("nether_mushroom")) && !namespace.equals("chipped") && !(namespace.equals("regions_unexplored") && path.contains("alpha"))) { BlockState state = baseBlock.getDefaultState(); - //can't check if the block is a full one, so I do this. Adding some checks here + // can't check if the block is a full one, so I do this. Adding some checks here if (state.getProperties().size() <= 2 && !(baseBlock instanceof SlabBlock)) { - //needs to use wood sound type - //if (state.getSoundType() == SoundType.WOOD) { //wood from tcon has diff sounds + // needs to use wood sound type + // if (state.getSoundType() == SoundType.WOOD) { //wood from tcon has diff sounds Material mat = state.getMaterial(); - //and have correct material + // and have correct material if (mat == Material.WOOD || mat == Material.NETHER_WOOD) { - //we do not allow "/" in the wood name + // we do not allow "/" in the wood name name = name.replace("/", "_"); Identifier id = new Identifier(blockId.getNamespace(), name); Block logBlock = findLog(id); diff --git a/common/src/main/java/com/unlikepaladin/pfm/entity/render/SkinGetter.java b/common/src/main/java/com/unlikepaladin/pfm/entity/render/SkinGetter.java index 0163314f5..a5d6e9d80 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/entity/render/SkinGetter.java +++ b/common/src/main/java/com/unlikepaladin/pfm/entity/render/SkinGetter.java @@ -47,7 +47,7 @@ public Identifier getjson() { System.out.println("DEBUG:" + basejson); byte[] decodedBytes = Base64.getDecoder().decode(basejson); String decodedjson = new String(decodedBytes); - //System.out.println("DEBUG:" + decodedjson); + // System.out.println("DEBUG:" + decodedjson); if (decodedjson.contains("url")) { String str = decodedjson.substring(decodedjson.lastIndexOf("\"http") + 1, decodedjson.indexOf("}")); diff --git a/common/src/main/java/com/unlikepaladin/pfm/menus/AbstractMicrowaveScreenHandler.java b/common/src/main/java/com/unlikepaladin/pfm/menus/AbstractMicrowaveScreenHandler.java index b4f31d786..af5422060 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/menus/AbstractMicrowaveScreenHandler.java +++ b/common/src/main/java/com/unlikepaladin/pfm/menus/AbstractMicrowaveScreenHandler.java @@ -26,7 +26,7 @@ public abstract class AbstractMicrowaveScreenHandler extends AbstractRecipeScree private final RecipeBookCategory category; public boolean isActive; public MicrowaveBlockEntity microwaveBlockEntity; - //Client Constructor + // Client Constructor protected AbstractMicrowaveScreenHandler(MicrowaveBlockEntity microwaveBlockEntity, ScreenHandlerType type, RecipeType recipeType, RecipeBookCategory category, int syncId, PlayerInventory playerInventory, PacketByteBuf buf) { this(microwaveBlockEntity, type, recipeType, category, syncId, playerInventory, new SimpleInventory(1), new ArrayPropertyDelegate(2)); this.isActive = buf.readBoolean(); @@ -34,7 +34,7 @@ protected AbstractMicrowaveScreenHandler(MicrowaveBlockEntity microwaveBlockEnti this.microwaveBlockEntity = microwaveBlockEntity; } - //Server Constructor + // Server Constructor protected AbstractMicrowaveScreenHandler(MicrowaveBlockEntity microwaveBlockEntity, ScreenHandlerType type, RecipeType recipeType, RecipeBookCategory category, int syncId, PlayerInventory playerInventory, Inventory inventory, PropertyDelegate propertyDelegate) { super(type, syncId); this.microwaveBlockEntity = microwaveBlockEntity; diff --git a/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java b/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java index 44f149294..a7a6b14f3 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java +++ b/common/src/main/java/com/unlikepaladin/pfm/menus/WorkbenchScreenHandler.java @@ -166,17 +166,17 @@ public int getVisibleRecipeCount() { } public void updateInput() { - //Reset the selected recipe and clear the output slot + // Reset the selected recipe and clear the output slot if (!this.availableRecipes.isEmpty() && getSelectedRecipe() != -1) { if (!this.sortedRecipes.get(getSelectedRecipe()).matches(playerInventory, world)){ this.selectedRecipe.set(-1); this.outputSlot.setStack(ItemStack.EMPTY); } } - //Reset the available recipes list and add all recipes that can be crafted + // Reset the available recipes list and add all recipes that can be crafted this.availableRecipes.clear(); this.availableRecipes.addAll(allRecipes.stream().filter(newFurnitureRecipe -> newFurnitureRecipe.matches(playerInventory, world)).toList()); - //Clear the visible recipe list and add the craft-able recipes first, then add the rest, checking that it's not present already so that it's not overridden. + // Clear the visible recipe list and add the craft-able recipes first, then add the rest, checking that it's not present already so that it's not overridden. this.sortedRecipes.clear(); this.sortedRecipes.addAll(availableRecipes); this.sortedRecipes.addAll(allRecipes.stream().filter(furnitureRecipe -> !sortedRecipes.contains(furnitureRecipe)).toList()); 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 dd45255d3..440661f67 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 @@ -155,28 +155,28 @@ public void registerTuckableChairs() { } public void registerTables() { - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicTableBlock.class).getVariantToBlockMap(), "table_basic", TEMPLATE_BASIC_TABLE_ARRAY, PFMBlockStateModelGenerator::createAxisOrientableTableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicTableBlock.class).getVariantToBlockMapNonBase(), "table_basic", TEMPLATE_BASIC_TABLE_ARRAY, PFMBlockStateModelGenerator::createAxisOrientableTableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicTableBlock.class).getVariantToBlockMap(), "table_basic", PFMBlockStateModelGenerator::createAxisOrientableTableBlockState); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicTableBlock.class).getVariantToBlockMapNonBase(), "table_basic", PFMBlockStateModelGenerator::createAxisOrientableTableBlockState); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicTableBlock.class).getVariantToBlockMap(), "table_classic", TEMPLATE_CLASSIC_TABLE_ARRAY, PFMBlockStateModelGenerator::createSingleStateBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicTableBlock.class).getVariantToBlockMapNonBase(), "table_classic", TEMPLATE_CLASSIC_TABLE_ARRAY, PFMBlockStateModelGenerator::createSingleStateBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicTableBlock.class).getVariantToBlockMap(), "table_classic", PFMBlockStateModelGenerator::createSingleStateBlockState); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicTableBlock.class).getVariantToBlockMapNonBase(), "table_classic", PFMBlockStateModelGenerator::createSingleStateBlockState); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogTableBlock.class).getVariantToBlockMap(), "log_table", TEMPLATE_LOG_TABLE_ARRAY, PFMBlockStateModelGenerator::createOrientableTableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogTableBlock.class).getVariantToBlockMapNonBase(), "log_table", TEMPLATE_LOG_TABLE_ARRAY, PFMBlockStateModelGenerator::createOrientableTableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogTableBlock.class).getVariantToBlockMap(), "log_table", PFMBlockStateModelGenerator::createOrientableTableBlockState); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogTableBlock.class).getVariantToBlockMapNonBase(), "log_table", PFMBlockStateModelGenerator::createOrientableTableBlockState); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(RawLogTableBlock.class).getVariantToBlockMap(), "log_table", TEMPLATE_LOG_TABLE_ARRAY, PFMBlockStateModelGenerator::createOrientableTableBlockState, PFMBlockStateModelGenerator::createRawBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(RawLogTableBlock.class).getVariantToBlockMapNonBase(), "log_table", TEMPLATE_LOG_TABLE_ARRAY, PFMBlockStateModelGenerator::createOrientableTableBlockState, PFMBlockStateModelGenerator::createRawBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(RawLogTableBlock.class).getVariantToBlockMap(), "log_table", PFMBlockStateModelGenerator::createOrientableTableBlockState); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(RawLogTableBlock.class).getVariantToBlockMapNonBase(), "log_table", PFMBlockStateModelGenerator::createOrientableTableBlockState); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerTableBlock.class).getVariantToBlockMap(), "dinner_table", TEMPLATE_DINNER_TABLE_ARRAY, (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerTableBlock.class).getVariantToBlockMapNonBase(), "dinner_table", TEMPLATE_DINNER_TABLE_ARRAY, (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerTableBlock.class).getVariantToBlockMap(), "dinner_table", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerTableBlock.class).getVariantToBlockMapNonBase(), "dinner_table", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernDinnerTableBlock.class).getVariantToBlockMap(), "table_modern_dinner", TEMPLATE_MODERN_DINNER_TABLE_ARRAY, (block, identifiers) -> createAxisOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernDinnerTableBlock.class).getVariantToBlockMapNonBase(), "table_modern_dinner", TEMPLATE_MODERN_DINNER_TABLE_ARRAY, (block, identifiers) -> createAxisOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernDinnerTableBlock.class).getVariantToBlockMap(), "modern_dinner_table", (block, identifiers) -> createAxisOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernDinnerTableBlock.class).getVariantToBlockMapNonBase(), "modern_dinner_table", (block, identifiers) -> createAxisOrientableTableBlockState(block, identifiers, 90)); } public void registerNightStands() { - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicNightstandBlock.class).getVariantToBlockMap(), "classic_nightstand", TEMPLATE_CLASSIC_NIGHTSTAND_ARRAY, (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicNightstandBlock.class).getVariantToBlockMapNonBase(), "classic_nightstand", TEMPLATE_CLASSIC_NIGHTSTAND_ARRAY, (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicNightstandBlock.class).getVariantToBlockMap(), "classic_nightstand", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicNightstandBlock.class).getVariantToBlockMapNonBase(), "classic_nightstand", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); } public void registerBeds() { @@ -274,6 +274,20 @@ public static Texture createLogLogTopBlockTexture(Boolean stripped, VariantBase< Identifier top = stripped ? ModelHelper.getTextureId((Block) variantBase.getChild("stripped_log"), "_top") : ModelHelper.getTextureId(variantBase.getSecondaryBlock(), "_top"); return new Texture().put(LOG_KEY, legs).put(LOG_TOP_KEY, top); } + + public void generateBlockStateForBlock(Map, ? extends Block> variantBaseHashMap, String blockName, BiFunction, BlockStateSupplier> stateSupplierBiFunction) { + variantBaseHashMap.forEach((variantBase, block) -> { + if (!generatedStates.contains(Registry.BLOCK.getId(block))) { + Identifier modelID = ModelIds.getBlockModelId(block); + Identifier id = new Identifier(modelID.getNamespace(), "block/" + blockName); + List ids = new ArrayList<>(1); + ids.add(id); + this.blockStateCollector.accept(stateSupplierBiFunction.apply(block, ids)); + generatedStates.add(Registry.BLOCK.getId(block)); + } + }); + } + public void generateModelAndBlockStateForVariants(Map, ? extends Block> variantBaseHashMap, String blockName, Model[] models, BiFunction, BlockStateSupplier> stateSupplierBiFunction, BiFunction, Texture> textureBiFunction) { variantBaseHashMap.forEach((variantBase, block) -> { if (!generatedStates.contains(Registry.BLOCK.getId(block))) { @@ -405,7 +419,13 @@ private static BlockStateSupplier createSingleStateBlockState(Block block, List< private static BlockStateSupplier createAxisOrientableTableBlockState(Block block, List modelIdentifiers, int rotation) { Map variantMap = new HashMap<>(); String path = modelIdentifiers.get(0).getPath(); - Identifier id = new Identifier(modelIdentifiers.get(0).getNamespace(), path.split(path.substring(path.lastIndexOf('/')))[0] + path.substring(path.lastIndexOf('/'))); + Identifier id; + + if (modelIdentifiers.size() == 1) { + id = modelIdentifiers.get(0); + } else { + id = new Identifier(modelIdentifiers.get(0).getNamespace(), path.split(path.substring(path.lastIndexOf('/')))[0] + path.substring(path.lastIndexOf('/'))); + } Integer[] rotationArray = new Integer[]{0, 90}; for (int i = 0; rotationArray.length > i; i++) { if (rotationArray[i] + rotation > 90) { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand.json index f3c2f81e5..b836b0fd0 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left.json index 35383d3c5..2260f51f0 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left_open.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left_open.json index 61825d053..80c6b2e52 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left_open.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_left_open.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle.json index c0e26dd98..76f8c8142 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json index 0df828230..78340a260 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_plank", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_open.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_open.json index b4c3d1cfe..5c63d3ca7 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_open.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_open.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right.json index 613b5720c..0753ae1c1 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right_open.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right_open.json index a8340367b..59348eb72 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right_open.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_right_open.json @@ -3,9 +3,9 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "#texture", - "particle": "#log", - "support": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "support": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table.json b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table.json index 5a478d879..b8b1fa761 100644 --- a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table.json +++ b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_left.json b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_left.json index e059f00d2..1c0b2fda3 100644 --- a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_left.json +++ b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_left.json @@ -1,25 +1,10 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ - { - "name": "top", - "from": [0, 14, 0], - "to": [16, 16, 16], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 8]}, - "faces": { - "north": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "east": {"uv": [1, 1, 15, 3], "texture": "#base"}, - "south": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "west": {"uv": [0, 0, 14, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 15, 14], "rotation": 270, "texture": "#base"}, - "down": {"uv": [0, 1, 14, 14], "rotation": 90, "texture": "#base"} - } - }, { "from": [14.00357, -0.51331, 2], "to": [16.00357, 19.48669, 4], @@ -94,12 +79,11 @@ "origin": [0, 0, 0], "color": 0, "children": [ - 0, { "name": "legs", "origin": [0, 0, 0], "color": 0, - "children": [1, 2] + "children": [0, 1] } ] } diff --git a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_legs.json b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_legs.json new file mode 100644 index 000000000..a5cb6e96a --- /dev/null +++ b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_legs.json @@ -0,0 +1,117 @@ +{ + "credit": "By UnlikePaladin", + "textures": { + "legs": "block/oak_log", + "particle": "block/oak_planks" + }, + "elements": [ + { + "from": [14.00357, -0.51331, 2], + "to": [16.00357, 19.48669, 4], + "rotation": {"angle": 45, "axis": "z", "origin": [14.04688, 0, 3]}, + "faces": { + "north": {"uv": [6, 0, 8, 16], "texture": "#legs"}, + "east": {"uv": [9, 0, 11, 16], "texture": "#legs"}, + "south": {"uv": [1, 0, 3, 16], "texture": "#legs"}, + "west": {"uv": [3, 0, 5, 16], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [7, 5, 9, 7], "texture": "#legs"} + } + }, + { + "from": [0.34375, -1.875, 2.0625], + "to": [2.34375, 18.125, 4.0625], + "rotation": {"angle": -45, "axis": "z", "origin": [4, 0, 3]}, + "faces": { + "north": {"uv": [1, 0, 3, 16], "texture": "#legs"}, + "east": {"uv": [9, 0, 11, 16], "texture": "#legs"}, + "south": {"uv": [3, 0, 5, 16], "texture": "#legs"}, + "west": {"uv": [6, 0, 8, 16], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [1, 3, 3, 5], "texture": "#legs"} + } + }, + { + "from": [14.00357, -0.51331, 12], + "to": [16.00357, 19.48669, 14], + "rotation": {"angle": 45, "axis": "z", "origin": [14.04688, 0, 13]}, + "faces": { + "north": {"uv": [6, 0, 8, 16], "texture": "#legs"}, + "east": {"uv": [9, 0, 11, 16], "texture": "#legs"}, + "south": {"uv": [1, 0, 3, 16], "texture": "#legs"}, + "west": {"uv": [3, 0, 5, 16], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 2, 2, 4], "texture": "#legs"} + } + }, + { + "from": [0.34375, -1.875, 12.0625], + "to": [2.34375, 18.125, 14.0625], + "rotation": {"angle": -45, "axis": "z", "origin": [4, 0, 13]}, + "faces": { + "north": {"uv": [1, 0, 3, 16], "texture": "#legs"}, + "east": {"uv": [9, 0, 11, 16], "texture": "#legs"}, + "south": {"uv": [3, 0, 5, 16], "texture": "#legs"}, + "west": {"uv": [6, 0, 8, 16], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [1, 4, 3, 6], "texture": "#legs"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.39, 0.39, 0.39] + }, + "thirdperson_lefthand": { + "rotation": [59, 58, 0], + "translation": [0.5, 1, 0], + "scale": [0.39, 0.39, 0.39] + }, + "firstperson_righthand": { + "rotation": [-1, -146, 0], + "translation": [0, 0.75, 0], + "scale": [0.44, 0.44, 0.44] + }, + "firstperson_lefthand": { + "rotation": [-1, 32, 0], + "translation": [0, 0.75, 0], + "scale": [0.44, 0.44, 0.44] + }, + "ground": { + "translation": [0, -0.75, 0], + "scale": [0.39, 0.39, 0.39] + }, + "gui": { + "rotation": [30, -45, 0], + "translation": [0, -0.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [-1, 90, 0], + "translation": [0, 4.5, 0], + "scale": [0.93, 0.95, 0.92] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, -3, -5.5], + "scale": [0.9, 0.9, 0.9] + } + }, + "groups": [ + { + "name": "table", + "origin": [0, 0, 0], + "color": 0, + "children": [ + { + "name": "legs", + "origin": [0, 0, 0], + "color": 0, + "children": [0, 1, 2, 3] + } + ] + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_middle.json b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_middle.json index 65bc3be53..144d3ed42 100644 --- a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_middle.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "block/oak_planks", + "base": "block/oak_planks" }, "elements": [ { @@ -46,9 +46,9 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [13, -58, 0], + "rotation": [30, -45, 0], "translation": [0, -0.5, 0], - "scale": [0.58, 0.58, 0.58] + "scale": [0.625, 0.625, 0.625] }, "head": { "rotation": [-1, 90, 0], diff --git a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_right.json b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_right.json index 3a73a8c54..5379bf108 100644 --- a/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_right.json +++ b/common/src/main/resources/assets/pfm/models/block/dinner_table/dinner_table_right.json @@ -1,25 +1,10 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ - { - "name": "top", - "from": [0, 14, 0], - "to": [16, 16, 16], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 8]}, - "faces": { - "north": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "east": {"uv": [1, 1, 15, 3], "texture": "#base"}, - "south": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "west": {"uv": [0, 0, 14, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 15, 14], "rotation": 270, "texture": "#base"}, - "down": {"uv": [0, 1, 14, 14], "rotation": 90, "texture": "#base"} - } - }, { "from": [0.34375, -1.875, 12.0625], "to": [2.34375, 18.125, 14.0625], @@ -94,12 +79,11 @@ "origin": [0, 0, 0], "color": 0, "children": [ - 0, { "name": "legs", "origin": [0, 0, 0], "color": 0, - "children": [1, 2] + "children": [0, 1] } ] } diff --git a/common/src/main/resources/assets/pfm/models/block/log_table/log_table.json b/common/src/main/resources/assets/pfm/models/block/log_table/log_table.json index d521dc8a9..15a95ad96 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_table/log_table.json +++ b/common/src/main/resources/assets/pfm/models/block/log_table/log_table.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { @@ -29,8 +29,8 @@ "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, - "up": {"uv": [0, 0, 2.5, 6], "texture": "#legs"}, - "down": {"uv": [0, 0, 2.5, 6], "texture": "#legs"} + "up": {"uv": [0, 0, 3, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "texture": "#legs"} } }, { @@ -42,8 +42,8 @@ "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, - "up": {"uv": [0, 0, 2.5, 6], "texture": "#legs"}, - "down": {"uv": [0, 0, 2.5, 6], "texture": "#legs"} + "up": {"uv": [0, 0, 3, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "texture": "#legs"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_left.json b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_left.json index 1f03dd40e..7df2cb278 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_left.json +++ b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_left.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { @@ -14,8 +14,8 @@ "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, - "up": {"uv": [0, 0, 2.5, 6], "texture": "#legs"}, - "down": {"uv": [0, 0, 2.5, 6], "texture": "#legs"} + "up": {"uv": [0, 0, 3, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "texture": "#legs"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_legs.json b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_legs.json new file mode 100644 index 000000000..83bdf76ae --- /dev/null +++ b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_legs.json @@ -0,0 +1,91 @@ +{ + "credit": "By UnlikePaladin", + "textures": { + "particle": "block/oak_planks", + "legs": "block/oak_log" + }, + "elements": [ + { + "from": [2, 0, 5], + "to": [4.5, 14, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 13], "texture": "#legs"}, + "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, + "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, + "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, + "up": {"uv": [0, 0, 3, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "texture": "#legs"} + } + }, + { + "from": [11.5, 0, 5], + "to": [14, 14, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 8]}, + "faces": { + "north": {"uv": [0, 0, 3, 13], "texture": "#legs"}, + "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, + "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, + "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, + "up": {"uv": [0, 0, 3, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "texture": "#legs"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.39, 0.39, 0.39] + }, + "thirdperson_lefthand": { + "rotation": [59, 58, 0], + "translation": [0.5, 1, 0], + "scale": [0.39, 0.39, 0.39] + }, + "firstperson_righthand": { + "rotation": [-1, -146, 0], + "translation": [0, 0.75, 0], + "scale": [0.44, 0.44, 0.44] + }, + "firstperson_lefthand": { + "rotation": [-1, 32, 0], + "translation": [0, 0.75, 0], + "scale": [0.44, 0.44, 0.44] + }, + "ground": { + "translation": [0, -0.75, 0], + "scale": [0.39, 0.39, 0.39] + }, + "gui": { + "rotation": [30, -135, 0], + "translation": [0, -0.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [-1, 90, 0], + "translation": [0, 4.5, 0], + "scale": [0.93, 0.95, 0.92] + }, + "fixed": { + "rotation": [0, 90, 0], + "translation": [0, -3, -5.5], + "scale": [0.9, 0.9, 0.9] + } + }, + "groups": [ + { + "name": "table", + "origin": [0, 0, 0], + "color": 0, + "children": [ + { + "name": "legs", + "origin": [0, 0, 0], + "color": 0, + "children": [0, 1] + } + ] + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_middle.json b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_middle.json index e6c8b6563..9b1b361c9 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_middle.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "block/oak_planks", + "base": "block/oak_planks" }, "elements": [ { @@ -46,9 +46,9 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [13, -58, 0], + "rotation": [30, 135, 0], "translation": [0, -0.5, 0], - "scale": [0.58, 0.58, 0.58] + "scale": [0.625, 0.625, 0.625] }, "head": { "rotation": [-1, 90, 0], diff --git a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_right.json b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_right.json index d4b0f167a..8bf18504a 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_table/log_table_right.json +++ b/common/src/main/resources/assets/pfm/models/block/log_table/log_table_right.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "legs": "#log" + "legs": "block/oak_log", + "particle": "block/oak_planks" }, "elements": [ { @@ -14,8 +14,8 @@ "east": {"uv": [0, 0, 6, 13], "texture": "#legs"}, "south": {"uv": [0, 0, 3, 13], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 13], "texture": "#legs"}, - "up": {"uv": [0, 0, 2.5, 6], "rotation": 180, "texture": "#legs"}, - "down": {"uv": [0, 0, 2.5, 6], "rotation": 180, "texture": "#legs"} + "up": {"uv": [0, 0, 3, 6], "rotation": 180, "texture": "#legs"}, + "down": {"uv": [0, 0, 3, 6], "rotation": 180, "texture": "#legs"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic.json index e7fe8b53c..87cd1e3c8 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_base.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_base.json index 9cc457625..9b1b361c9 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_base.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_base.json @@ -1,9 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks" }, "elements": [ { @@ -47,9 +46,9 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [13, -58, 0], + "rotation": [30, 135, 0], "translation": [0, -0.5, 0], - "scale": [0.58, 0.58, 0.58] + "scale": [0.625, 0.625, 0.625] }, "head": { "rotation": [-1, 90, 0], diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_north.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_north.json index 883d94541..78fb48134 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_north.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_north.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_south.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_south.json index e2f55091d..01fed7985 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_south.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_east_west_south.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east.json index 41fbb8c38..a03a45239 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east_corner.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east_corner.json index 820ced15b..ad96c33df 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_east_corner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east.json index d038c70dc..3b7c49428 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_bottom.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_bottom.json index 5549485cf..c474cd7a1 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_bottom.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_top.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_top.json index 105d82ea4..77db7251a 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_top.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_east_top.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west.json index 320816d4f..5ca9e8be0 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_bottom.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_bottom.json index 8315c7b73..2bbf4add0 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_bottom.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_top.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_top.json index f0515a48f..bfc60e1e1 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_top.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_south_west_top.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west.json index 8f53e3865..0a5ff2b0e 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west_corner.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west_corner.json index 224a1ccaa..640c11296 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_north_west_corner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east.json index 0fe2f65df..d8d5acce6 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east_corner.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east_corner.json index 1f27c852d..b32349be6 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_east_corner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west.json index f4d2e51bf..df4b182b5 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west_corner.json b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west_corner.json index 07dcb48c3..15790b553 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/table_basic/table_basic_south_west_corner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic.json index 3a65af60e..80271de4d 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_middle.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_middle.json index e8d82c31d..11cf09b66 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_middle.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "block/oak_planks", + "base": "block/oak_planks" }, "elements": [ { @@ -45,9 +45,9 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [13, -58, 0], + "rotation": [30, 45, 0], "translation": [0, -0.5, 0], - "scale": [0.58, 0.58, 0.58] + "scale": [0.625, 0.625, 0.625] }, "head": { "rotation": [-1, 90, 0], diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one.json index 541498a08..3ec3161a8 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log", - "particle": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one_uved.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one_uved.json index 0e5c62ee5..1b42063cf 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one_uved.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_one_uved.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log", - "particle": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two.json index 9211e8517..1435b656c 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log" + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two_uved.json b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two_uved.json index 3229cb00b..a56bad0f1 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two_uved.json +++ b/common/src/main/resources/assets/pfm/models/block/table_classic/table_classic_two_uved.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner.json index 8552a047a..d253dd994 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner.json +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_base.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_base.json new file mode 100644 index 000000000..385686513 --- /dev/null +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_base.json @@ -0,0 +1,86 @@ +{ + "credit": "By UnlikePaladin", + "textures": { + "particle": "block/oak_planks", + "base": "block/oak_planks" + }, + "elements": [ + { + "name": "Seat", + "from": [0, 14, 0], + "to": [16, 16, 16], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 8]}, + "faces": { + "north": {"uv": [0, 0, 14, 2], "texture": "#base"}, + "east": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, + "south": {"uv": [1, 1, 15, 3], "texture": "#base"}, + "west": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, + "up": {"uv": [1, 1, 15, 14], "texture": "#base"}, + "down": {"uv": [0, 1, 14, 14], "texture": "#base"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.32, 0.32, 0.32] + }, + "thirdperson_lefthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.32, 0.32, 0.32] + }, + "firstperson_righthand": { + "rotation": [-1, -146, 0], + "translation": [1, 0.75, 0], + "scale": [0.32, 0.32, 0.32] + }, + "firstperson_lefthand": { + "rotation": [-1, -146, 0], + "translation": [1, 0.75, 0], + "scale": [0.32, 0.32, 0.32] + }, + "ground": { + "translation": [0, -0.75, 0], + "scale": [0.39, 0.39, 0.39] + }, + "gui": { + "rotation": [30, 45, 0], + "translation": [0, -0.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [-1, 90, 0], + "translation": [0, 4.5, 0], + "scale": [0.93, 0.95, 0.92] + }, + "fixed": { + "rotation": [0, -180, 0], + "translation": [0, -0.5, -0.75], + "scale": [0.9, 0.9, 0.9] + } + }, + "groups": [ + { + "name": "chair", + "origin": [0, 0, 0], + "color": 0, + "children": [ + { + "name": "Backrest", + "origin": [0, 0, 0], + "color": 0, + "children": [] + }, + 0, + { + "name": "legs", + "origin": [0, 0, 0], + "color": 0, + "children": [] + } + ] + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_left.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_left.json index 07b42c653..7daae3017 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_left.json @@ -1,25 +1,10 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ - { - "name": "Table", - "from": [0, 14, 0], - "to": [16, 16, 16], - "rotation": {"angle": 0, "axis": "y", "origin": [4.75, 6.83333, 8]}, - "faces": { - "north": {"uv": [1, 1, 15, 3], "texture": "#base"}, - "east": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "south": {"uv": [0, 0, 14, 2], "texture": "#base"}, - "west": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "up": {"uv": [1, 1, 15, 14], "rotation": 180, "texture": "#base"}, - "down": {"uv": [0, 1, 14, 14], "rotation": 180, "texture": "#base"} - } - }, { "from": [13, 2, 7], "to": [15, 14, 9], @@ -139,12 +124,11 @@ "color": 0, "children": [] }, - 0, { "name": "legs", "origin": [0, 0, 0], "color": 0, - "children": [1, 2, 3, 4, 5] + "children": [0, 1, 2, 3, 4] } ] } diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_legs.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_legs.json new file mode 100644 index 000000000..eb22be7f7 --- /dev/null +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_legs.json @@ -0,0 +1,188 @@ +{ + "credit": "By UnlikePaladin", + "textures": { + "particle": "block/oak_planks", + "legs": "block/oak_log" + }, + "elements": [ + { + "from": [12, 0, 12], + "to": [14, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 13]}, + "faces": { + "north": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + }, + { + "from": [12, 0, 2], + "to": [14, 14, 4], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 3]}, + "faces": { + "north": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + }, + { + "from": [13, 2, 7], + "to": [15, 14, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 3]}, + "faces": { + "north": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + }, + { + "from": [1, 2, 7], + "to": [3, 14, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 0, 3]}, + "faces": { + "north": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 12], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + }, + { + "from": [2, 0, 2], + "to": [4, 14, 4], + "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 3]}, + "faces": { + "north": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + }, + { + "from": [2, 0, 4], + "to": [4, 2, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 13]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 180, "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 8], "rotation": 270, "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 8], "rotation": 90, "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 8], "rotation": 180, "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 8], "texture": "#legs"} + } + }, + { + "from": [3, 2, 7], + "to": [13, 4, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 13]}, + "faces": { + "north": {"uv": [0, 0, 2, 10], "rotation": 270, "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 10], "rotation": 90, "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 2], "rotation": 180, "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 10], "rotation": 90, "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 10], "rotation": 90, "texture": "#legs"} + } + }, + { + "from": [12, 0, 4], + "to": [14, 2, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 13]}, + "faces": { + "north": {"uv": [0, 0, 2, 2], "rotation": 180, "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 8], "rotation": 270, "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 8], "rotation": 90, "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 8], "rotation": 180, "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 8], "texture": "#legs"} + } + }, + { + "from": [2, 0, 12], + "to": [4, 14, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 13]}, + "faces": { + "north": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "south": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "west": {"uv": [0, 0, 2, 14], "texture": "#legs"}, + "up": {"uv": [0, 0, 2, 2], "texture": "#legs"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + } + } + ], + "display": { + "thirdperson_righthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.32, 0.32, 0.32] + }, + "thirdperson_lefthand": { + "rotation": [59, -140, 0], + "translation": [-0.5, 0.25, -1.5], + "scale": [0.32, 0.32, 0.32] + }, + "firstperson_righthand": { + "rotation": [-1, -146, 0], + "translation": [1, 0.75, 0], + "scale": [0.32, 0.32, 0.32] + }, + "firstperson_lefthand": { + "rotation": [-1, -146, 0], + "translation": [1, 0.75, 0], + "scale": [0.32, 0.32, 0.32] + }, + "ground": { + "translation": [0, -0.75, 0], + "scale": [0.39, 0.39, 0.39] + }, + "gui": { + "rotation": [30, 45, 0], + "translation": [0, -0.5, 0], + "scale": [0.625, 0.625, 0.625] + }, + "head": { + "rotation": [-1, 90, 0], + "translation": [0, 4.5, 0], + "scale": [0.93, 0.95, 0.92] + }, + "fixed": { + "rotation": [0, -180, 0], + "translation": [0, -0.5, -0.75], + "scale": [0.9, 0.9, 0.9] + } + }, + "groups": [ + { + "name": "chair", + "origin": [0, 0, 0], + "color": 0, + "children": [ + { + "name": "Backrest", + "origin": [0, 0, 0], + "color": 0, + "children": [] + }, + { + "name": "legs", + "origin": [0, 0, 0], + "color": 0, + "children": [0, 1, 2, 3, 4, 5, 6, 7, 8] + } + ] + } + ] +} \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_middle.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_middle.json index 54aff7c4a..284a98267 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_middle.json @@ -1,25 +1,10 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ - { - "name": "Seat", - "from": [0, 14, 0], - "to": [16, 16, 16], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 8]}, - "faces": { - "north": {"uv": [0, 0, 14, 2], "texture": "#base"}, - "east": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "south": {"uv": [1, 1, 15, 3], "texture": "#base"}, - "west": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "up": {"uv": [1, 1, 15, 14], "texture": "#base"}, - "down": {"uv": [0, 1, 14, 14], "texture": "#base"} - } - }, { "from": [0, 2, 7], "to": [16, 4, 9], @@ -87,12 +72,11 @@ "color": 0, "children": [] }, - 0, { "name": "legs", "origin": [0, 0, 0], "color": 0, - "children": [1] + "children": [0] } ] } diff --git a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_right.json b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_right.json index 01146bf5b..a63aa94d8 100644 --- a/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/table_modern_dinner/table_modern_dinner_right.json @@ -1,25 +1,10 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ - { - "name": "Seat", - "from": [0, 14, 0], - "to": [16, 16, 16], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 13, 8]}, - "faces": { - "north": {"uv": [0, 0, 14, 2], "texture": "#base"}, - "east": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "south": {"uv": [1, 1, 15, 3], "texture": "#base"}, - "west": {"uv": [5, 1, 7, 14], "rotation": 90, "texture": "#base"}, - "up": {"uv": [1, 1, 15, 14], "texture": "#base"}, - "down": {"uv": [0, 1, 14, 14], "texture": "#base"} - } - }, { "from": [1, 2, 7], "to": [3, 14, 9], @@ -139,12 +124,11 @@ "color": 0, "children": [] }, - 0, { "name": "legs", "origin": [0, 0, 0], "color": 0, - "children": [1, 2, 3, 4, 5] + "children": [0, 1, 2, 3, 4] } ] } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/InnerTrashcanBlockImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/InnerTrashcanBlockImpl.java index df8390f29..fbbfed278 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/InnerTrashcanBlockImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/InnerTrashcanBlockImpl.java @@ -16,7 +16,7 @@ public static BlockEntity getBlockEntity(BlockPos pos, BlockState state) { public static void openScreen(PlayerEntity player, BlockState state, World world, BlockPos pos) { NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); if (screenHandlerFactory != null) { - //With this call the server will request the client to open the appropriate Screenhandler + // With this call the server will request the client to open the appropriate Screenhandler player.openHandledScreen(screenHandlerFactory); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/MicrowaveBlockImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/MicrowaveBlockImpl.java index 0e67f39fe..b3b9b3bf2 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/MicrowaveBlockImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/MicrowaveBlockImpl.java @@ -16,7 +16,7 @@ public static BlockEntity getBlockEntity(BlockPos pos, BlockState state) { public static void openScreen(PlayerEntity player, BlockState state, World world, BlockPos pos) { NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); if (screenHandlerFactory != null) { - //With this call the server will request the client to open the appropriate Screenhandler + // With this call the server will request the client to open the appropriate Screenhandler player.openHandledScreen(screenHandlerFactory); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/StoveBlockImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/StoveBlockImpl.java index b2d8be553..7af9e988c 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/StoveBlockImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/StoveBlockImpl.java @@ -25,7 +25,7 @@ public static BlockEntity getBlockEntity(BlockPos pos, BlockState state) { public static void openMenuScreen(World world, BlockPos pos, PlayerEntity player) { NamedScreenHandlerFactory screenHandlerFactory = world.getBlockState(pos).createScreenHandlerFactory(world, pos); if (screenHandlerFactory != null) { - //With this call the server will request the client to open the appropriate Screenhandler + // With this call the server will request the client to open the appropriate Screenhandler player.openHandledScreen(screenHandlerFactory); player.incrementStat(Statistics.STOVE_OPENED); } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/TrashcanBlockImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/TrashcanBlockImpl.java index dd1f4619e..8f57e22f4 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/TrashcanBlockImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/fabric/TrashcanBlockImpl.java @@ -16,7 +16,7 @@ public static BlockEntity getBlockEntity(BlockPos pos, BlockState state) { public static void openScreen(PlayerEntity player, BlockState state, World world, BlockPos pos) { NamedScreenHandlerFactory screenHandlerFactory = state.createScreenHandlerFactory(world, pos); if (screenHandlerFactory != null) { - //With this call the server will request the client to open the appropriate Screenhandler + // With this call the server will request the client to open the appropriate Screenhandler player.openHandledScreen(screenHandlerFactory); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java index 78170121c..8f183d06d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java @@ -30,7 +30,7 @@ public class FabricBasicLampModel extends AbstractBakedModel implements FabricBa private final Map> bakedModels; private final Map textureMap; public FabricBasicLampModel(Map textures, ModelBakeSettings settings, Map> bakedModels, List modelParts) { - super(textures.get(WoodVariantRegistry.OAK), settings, new HashMap<>()); + super(settings, bakedModels.get(WoodVariantRegistry.OAK).values().stream().toList()); this.modelParts = modelParts; this.textureMap = textures; this.bakedModels = bakedModels; diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/FabricBasicTableModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/FabricBasicTableModel.java index e3be7c48c..fecb6879f 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/FabricBasicTableModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/FabricBasicTableModel.java @@ -1,29 +1,30 @@ package com.unlikepaladin.pfm.blocks.models.basicTable.fabric; import com.unlikepaladin.pfm.blocks.BasicTableBlock; -import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Random; import java.util.function.Supplier; -public class FabricBasicTableModel extends AbstractBakedModel implements FabricBakedModel { - public FabricBasicTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class FabricBasicTableModel extends PFMFabricBakedModel { + public FabricBasicTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; + @Override public boolean isVanillaAdapter() { return false; @@ -43,126 +44,154 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean cornerSouthEast = south && east && !block.canConnect(world, state, pos.south().east(), pos); boolean cornerSouthWest = south && west && !block.canConnect(world, state, pos.south().west(), pos); - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + List spriteList = getSpriteList(state); + pushTextureTransform(context, spriteList.get(0)); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + + + pushTextureTransform(context, spriteList.get(1)); if (!north && !south && !east && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(8))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(7))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(8)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(7)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (dir == Direction.Axis.Z) { if (!north && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && south && !east && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(7))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(7)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (north && !south && !east && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(8))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(8)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && east && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(5))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(5)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !east && west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(10))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(10)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && east && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(9))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(9)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !east && west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(6))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(6)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && east && west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(12))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(12)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && east && west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(11))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(11)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerNorthEast) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(13))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(13)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerNorthWest) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(14))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(14)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerSouthWest) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(16))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(16)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerSouthEast) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(15))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(15)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { if (!north && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(9))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(9)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (north && !south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(10))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(10)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(5))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(5)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (north && !south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(6))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(6)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(7))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(7)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(8))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(8)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (north && south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(12))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (north && south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(11))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(11)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerNorthEast) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(14))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(14)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerSouthEast) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(13))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(13)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerNorthWest) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(16))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(16)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (cornerSouthWest) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(15))).emitBlockQuads(world, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(15)).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitBlockQuads(world, state, pos, randomSupplier, context); } } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + if (stack.getItem() instanceof BlockItem) { + pushTextureTransform(context, getSpriteList(stack).get(0)); + // base + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + pushTextureTransform(context, getSpriteList(stack).get(1)); + // legs + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitItemQuads(stack, randomSupplier, context); + // in between pieces + ((FabricBakedModel) getTemplateBakedModels().get(8)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(7)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java index 3dfe4355b..7d4142fe1 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/fabric/UnbakedBasicTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricBasicTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricBasicTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java index eaf22b322..4f4669fbe 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.bed.BedInterface; +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.BedBlock; @@ -22,10 +23,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricBedModel extends AbstractBakedModel implements FabricBakedModel, BedInterface { +public class FabricBedModel extends PFMFabricBakedModel implements BedInterface { private final List modelParts; public FabricBedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } @@ -44,31 +45,31 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos boolean bunk = isBed(blockView, pos, Direction.DOWN, dir, state, isClassic); BedPart part = state.get(BedBlock.PART); if (part == BedPart.HEAD) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(blockView, state, pos, randomSupplier, context); if (!right){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(6))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((6))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(7))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((7))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(10))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((10))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2))).emitBlockQuads(blockView, state, pos, randomSupplier, context); if (!right){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(5))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((5))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!right && bunk){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(8))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((8))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left && bunk){ - ((FabricBakedModel) getBakedModels().get(modelParts.get(9))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((9))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } } } @@ -78,4 +79,9 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java index dc0b38fe2..8149ad120 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java @@ -2,6 +2,8 @@ import com.unlikepaladin.pfm.blocks.ClassicNightstandBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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; @@ -18,12 +20,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricClassicNightstandModel extends AbstractBakedModel implements FabricBakedModel { - public FabricClassicNightstandModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); - this.modelParts = modelParts; +public class FabricClassicNightstandModel extends PFMFabricBakedModel { + public FabricClassicNightstandModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { @@ -38,20 +38,31 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean left = block.isStand(world, pos, dir.rotateYCounterclockwise(), dir); boolean right = block.isStand(world, pos, dir.rotateYClockwise(), dir); int openIndexOffset = state.get(ClassicNightstandBlock.OPEN) ? 4 : 0; + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakSprites(), spriteList); if (left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (!left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3+openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java index 31316b732..7a9e93e7f 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/UnbakedClassicNightstandModelImpl.java @@ -6,9 +6,15 @@ import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicNightstandModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricClassicNightstandModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricClassicNightstandModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/FabricClassicTableModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/FabricClassicTableModel.java index 759250777..6bf3ff826 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/FabricClassicTableModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/FabricClassicTableModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.ClassicTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -17,12 +18,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricClassicTableModel extends AbstractBakedModel implements FabricBakedModel { - public FabricClassicTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class FabricClassicTableModel extends PFMFabricBakedModel { + public FabricClassicTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -36,24 +35,44 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean east = block.canConnect(world.getBlockState(pos.east())); boolean west = block.canConnect(world.getBlockState(pos.west())); boolean south = block.canConnect(world.getBlockState(pos.south())); - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + pushTextureTransform(context, getSpriteList(state).get(0)); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + + pushTextureTransform(context, getSpriteList(state).get(1)); if (!north && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!north && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !west) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!south && !east) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + pushTextureTransform(context, getSpriteList(stack).get(0)); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + + pushTextureTransform(context, getSpriteList(stack).get(1)); + // legs + ((FabricBakedModel) getTemplateBakedModels().get(1)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(2)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get(4)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java index 741f95e29..63aef9372 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/fabric/UnbakedClassicTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricClassicTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricClassicTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/FabricDinnerTableModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/FabricDinnerTableModel.java index 325c12a16..4f541e0b3 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/FabricDinnerTableModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/FabricDinnerTableModel.java @@ -2,12 +2,14 @@ import com.unlikepaladin.pfm.blocks.DinnerTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -18,12 +20,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricDinnerTableModel extends AbstractBakedModel implements FabricBakedModel { - public FabricDinnerTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class FabricDinnerTableModel extends PFMFabricBakedModel { + public FabricDinnerTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -36,23 +36,44 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction dir = state.get(DinnerTableBlock.FACING); boolean left = block.isTable(world, pos, dir.rotateYCounterclockwise(), dir); boolean right = block.isTable(world, pos, dir.rotateYClockwise(), dir); - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + List spriteList = getSpriteList(state); + pushTextureTransform(context, spriteList.get(0)); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + + pushTextureTransform(context, spriteList.get(1)); if (!left && right) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 1 : 2; - ((FabricBakedModel) getBakedModels().get(modelParts.get(index))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((index))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && left) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 2 : 1; - ((FabricBakedModel) getBakedModels().get(modelParts.get(index))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((index))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && !left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + if (stack.getItem() instanceof BlockItem) { + pushTextureTransform(context, getSpriteList(stack).get(0)); + // base + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + pushTextureTransform(context, getSpriteList(stack).get(1)); + // legs + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java index adea8e53d..32e7db85e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/fabric/UnbakedDinnerTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedDinnerTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricDinnerTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricDinnerTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java new file mode 100644 index 000000000..a716484fd --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java @@ -0,0 +1,56 @@ +package com.unlikepaladin.pfm.blocks.models.fabric; + +import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.client.fabric.PFMBakedModelParticleExtension; +import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; +import net.fabricmc.fabric.api.renderer.v1.model.SpriteFinder; +import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; +import net.minecraft.client.texture.Sprite; +import net.minecraft.screen.PlayerScreenHandler; + +import java.util.List; +import java.util.Map; + +public abstract class PFMFabricBakedModel extends AbstractBakedModel implements FabricBakedModel, PFMBakedModelParticleExtension { + public PFMFabricBakedModel(ModelBakeSettings settings, List bakedModels) { + super(settings, bakedModels); + } + + public void pushTextureTransform(RenderContext context, Sprite sprite) { + context.pushTransform(quad -> { + Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)).find(quad, 0); + if (originalSprite.getId() != sprite.getId()) { + for (int index = 0; index < 4; index++) { + float frameU = originalSprite.method_35804(quad.spriteU(index, 0)); + float frameV = originalSprite.method_35805(quad.spriteV(index, 0)); + quad.sprite(index, 0, sprite.getFrameU(frameU), sprite.getFrameV(frameV)); + } + } + return true; + }); + } + + public void pushTextureTransform(RenderContext context, List toReplace, List replacement) { + context.pushTransform(quad -> { + Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)).find(quad, 0); + if (toReplace.stream().anyMatch(sprite -> originalSprite.getId().equals(sprite.getId())) && !toReplace.equals(replacement)) { + Sprite sprite = replacement.get(toReplace.indexOf(originalSprite)); + for (int index = 0; index < 4; index++) { + float frameU = originalSprite.method_35804(quad.spriteU(index, 0)); + float frameV = originalSprite.method_35805(quad.spriteV(index, 0)); + quad.sprite(index, 0, sprite.getFrameU(frameU), sprite.getFrameV(frameV)); + } + } + return true; + }); + } + + + @Override + public Sprite getParticleSprite() { + return getTemplateBakedModels().get(0).getParticleSprite(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFreezerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFreezerModel.java index b88205ca0..a5686a93a 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFreezerModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFreezerModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.FridgeBlock; import com.unlikepaladin.pfm.blocks.IronFridgeBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -19,9 +20,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricFreezerModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricFreezerModel extends PFMFabricBakedModel { public FabricFreezerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } private final List modelParts; @@ -36,9 +37,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean hasFridge = world.getBlockState(pos.down()).getBlock() instanceof FridgeBlock && !(world.getBlockState(pos.down()).getBlock() instanceof IronFridgeBlock); int openOffset = state.get(FreezerBlock.OPEN) ? 2 : 0; if (hasFridge) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } @@ -46,4 +47,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getParticleSprite(); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFridgeModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFridgeModel.java index fca1b814a..cd5c52574 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFridgeModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricFridgeModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.FridgeBlock; import com.unlikepaladin.pfm.blocks.IronFridgeBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -19,9 +20,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricFridgeModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricFridgeModel extends PFMFabricBakedModel { public FabricFridgeModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } private final List modelParts; @@ -38,22 +39,27 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean hasFreezer = world.getBlockState(pos.up()).getBlock() instanceof FreezerBlock && !(world.getBlockState(pos.up()).getBlock() instanceof IronFridgeBlock); int openOffset = state.get(FridgeBlock.OPEN) ? 6 : 0; if (top && hasFreezer) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(5+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((5+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (top && bottom) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (bottom) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (top) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (hasFreezer) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getParticleSprite(); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricIronFridgeModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricIronFridgeModel.java index 7ba2a94ed..09dc122d0 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricIronFridgeModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/fabric/FabricIronFridgeModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.IronFreezerBlock; import com.unlikepaladin.pfm.blocks.IronFridgeBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -18,9 +19,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricIronFridgeModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricIronFridgeModel extends PFMFabricBakedModel { public FabricIronFridgeModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } private final List modelParts; @@ -37,19 +38,24 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean hasFreezer = world.getBlockState(pos.down()).getBlock() instanceof IronFreezerBlock; int openOffset = state.get(IronFridgeBlock.OPEN) ? 5 : 0; if (top && bottom) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (bottom) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (top) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (hasFreezer) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4+openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getParticleSprite(); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java index a18f869ff..7a59a4d2e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCabinetBlock; import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -19,12 +20,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenCabinetModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenCabinetModel extends PFMFabricBakedModel { public FabricKitchenCabinetModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; + super(settings, bakedModels.values().stream().toList()); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -44,20 +43,20 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos BlockState blockState = world.getBlockState(pos.offset(direction)); if (block.isCabinet(blockState) && (direction2 = blockState.get(KitchenCabinetBlock.FACING)).getAxis() != state.get(KitchenCabinetBlock.FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { if (direction2 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else if (innerCorner) { if (direction3 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } } @@ -66,4 +65,9 @@ else if (innerCorner) { public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java index 29734bfa3..220f72a70 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.AbstractFurnaceBlock; @@ -20,12 +21,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenCounterModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenCounterModel extends PFMFabricBakedModel { public FabricKitchenCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; + super(settings, bakedModels.values().stream().toList()); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -44,10 +43,10 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { if (direction2 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(5))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((5))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(6))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((6))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { middleCounter(world, state, pos, randomSupplier, context, left, right); @@ -63,9 +62,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction3)) { if (direction3 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { middleCounter(world, state, pos, randomSupplier, context, left, right); @@ -79,17 +78,22 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi private void middleCounter(BlockRenderView world, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context, boolean left, boolean right) { if (left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java index 2bb125a79..e62ff2fb9 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterOvenBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -17,9 +18,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenCounterOvenModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenCounterOvenModel extends PFMFabricBakedModel { public FabricKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } @@ -36,9 +37,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean down = KitchenCounterOvenBlock.connectsVertical(world.getBlockState(pos.down()).getBlock()); int openOffset = state.get(KitchenCounterOvenBlock.OPEN) ? 2 : 0; if (up || down) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } } @@ -47,4 +48,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java index 53af7376f..71bdacb46 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.AbstractFurnaceBlock; @@ -20,9 +21,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenDrawerModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenDrawerModel extends PFMFabricBakedModel { public FabricKitchenDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -45,10 +46,10 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { if (direction2 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(5 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((5 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(6 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((6 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { middleCounter(world, state, pos, randomSupplier, context, left, right, openOffset); @@ -64,9 +65,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction3)) { if (direction3 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { middleCounter(world, state, pos, randomSupplier, context, left, right, openOffset); @@ -79,13 +80,13 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi private void middleCounter(BlockRenderView world, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context, boolean left, boolean right, int openOffset) { if (left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } @@ -93,4 +94,9 @@ private void middleCounter(BlockRenderView world, BlockState state, BlockPos pos public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java index 0e3079759..d3941b9d0 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.AbstractFurnaceBlock; @@ -20,9 +21,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenWallCounterModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenWallCounterModel extends PFMFabricBakedModel { public FabricKitchenWallCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -42,13 +43,13 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { if (direction2 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -61,16 +62,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction3)) { if (direction3 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } } } @@ -79,4 +80,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java index ba70326e2..d2e2d082d 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.AbstractFurnaceBlock; @@ -20,9 +21,9 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricKitchenWallDrawerModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricKitchenWallDrawerModel extends PFMFabricBakedModel { public FabricKitchenWallDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -43,13 +44,13 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { if (direction2 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((4 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -62,16 +63,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction3)) { if (direction3 == direction.rotateYCounterclockwise()) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1 + openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getBakedModels().get(modelParts.get(openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } } } @@ -80,4 +81,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/FabricLogTableModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/FabricLogTableModel.java index 163f02fbe..9e812830f 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/FabricLogTableModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/FabricLogTableModel.java @@ -2,12 +2,14 @@ import com.unlikepaladin.pfm.blocks.LogTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -18,12 +20,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricLogTableModel extends AbstractBakedModel implements FabricBakedModel { - public FabricLogTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class FabricLogTableModel extends PFMFabricBakedModel { + public FabricLogTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -36,23 +36,44 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction dir = state.get(LogTableBlock.FACING); boolean left = block.isTable(world, pos, dir.rotateYCounterclockwise(), dir); boolean right = block.isTable(world, pos, dir.rotateYClockwise(), dir); - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + List spriteList = getSpriteList(state); + pushTextureTransform(context, spriteList.get(0)); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + + pushTextureTransform(context, spriteList.get(1)); if (!left && right) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 1 : 2; - ((FabricBakedModel) getBakedModels().get(modelParts.get(index))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((index))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && left) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 2 : 1; - ((FabricBakedModel) getBakedModels().get(modelParts.get(index))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((index))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && !left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + if (stack.getItem() instanceof BlockItem) { + pushTextureTransform(context, getSpriteList(stack).get(0)); + // base + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + pushTextureTransform(context, getSpriteList(stack).get(1)); + // legs + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java index 4048ce4d2..d900e3f12 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/fabric/UnbakedLogTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricLogTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricLogTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/fabric/FabricMirrorModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/fabric/FabricMirrorModel.java index 1dbc1865c..8bbc252fe 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/fabric/FabricMirrorModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/fabric/FabricMirrorModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.MirrorBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.fabric.PFMFabricBakedModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; import net.fabricmc.fabric.api.renderer.v1.model.ModelHelper; @@ -21,17 +22,15 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricMirrorModel extends AbstractBakedModel implements FabricBakedModel { +public class FabricMirrorModel extends PFMFabricBakedModel { public FabricMirrorModel(Sprite frame, Sprite glassTex, Sprite reflectTex, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; + super(settings, bakedModels.values().stream().toList()); this.glassTex = glassTex; this.reflectTex = reflectTex; } protected final Sprite glassTex; protected final Sprite reflectTex; - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -52,42 +51,47 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos boolean cornerLeftDown = block.canConnect(blockView.getBlockState(pos.offset(facing.rotateYClockwise()).down()), state); boolean cornerRightUp = block.canConnect(blockView.getBlockState(pos.offset(facing.rotateYCounterclockwise()).up()), state); - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(0))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((0))); if (!down) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(2))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((2))); } if (!up) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(1))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((1))); } if (!right) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(3))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((3))); } if (!left) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(4))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((4))); } if (!cornerLeftDown) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(8))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((8))); } if (!cornerRightDown) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(7))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((7))); } if (!cornerLeftUp) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(6))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((6))); } if (!cornerRightUp) { - context.fallbackConsumer().accept(getBakedModels().get(modelParts.get(5))); + context.fallbackConsumer().accept(getTemplateBakedModels().get((5))); } } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - context.fallbackConsumer().accept(getBakedModels().get(UnbakedMirrorModel.BASE_MODEL_PARTS[0])); + context.fallbackConsumer().accept(getTemplateBakedModels().get(0)); } @Override public ModelTransformation getTransformation() { return ModelHelper.MODEL_TRANSFORM_BLOCK; } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getParticleSprite(); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/FabricModernDinnerTableModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/FabricModernDinnerTableModel.java index 55632ae02..e27b933c0 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/FabricModernDinnerTableModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/FabricModernDinnerTableModel.java @@ -2,12 +2,14 @@ import com.unlikepaladin.pfm.blocks.ModernDinnerTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -18,12 +20,10 @@ import java.util.Random; import java.util.function.Supplier; -public class FabricModernDinnerTableModel extends AbstractBakedModel implements FabricBakedModel { - public FabricModernDinnerTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class FabricModernDinnerTableModel extends PFMFabricBakedModel { + public FabricModernDinnerTableModel(ModelBakeSettings settings, List modelList) { + super(settings, modelList); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -36,23 +36,45 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction.Axis dir = state.get(ModernDinnerTableBlock.AXIS); boolean left = block.isTable(world, pos, dir, -1); boolean right = block.isTable(world, pos, dir, 1); + List spriteList = getSpriteList(state); + pushTextureTransform(context, spriteList.get(0)); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + + pushTextureTransform(context, spriteList.get(1)); if (left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(0))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(4)).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!left && right) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(1))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((1))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(2))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((2))).emitBlockQuads(world, state, pos, randomSupplier, context); } if (!right && !left) { - ((FabricBakedModel) getBakedModels().get(modelParts.get(3))).emitBlockQuads(world, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + if (stack.getItem() instanceof BlockItem) { + pushTextureTransform(context, getSpriteList(stack).get(0)); + // base + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + pushTextureTransform(context, getSpriteList(stack).get(1)); + // legs + ((FabricBakedModel) getTemplateBakedModels().get(3)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); } } \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java index 93c407392..2461ce18e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/fabric/UnbakedModernDinnerTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernDinnerTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricModernDinnerTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricModernDinnerTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java new file mode 100644 index 000000000..255d5ec1e --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java @@ -0,0 +1,8 @@ +package com.unlikepaladin.pfm.client.fabric; + +import net.minecraft.block.BlockState; +import net.minecraft.client.texture.Sprite; + +public interface PFMBakedModelParticleExtension { + Sprite pfm$getParticle(BlockState state); +} 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 18712ee3a..753a95ea1 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,18 +22,31 @@ import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; +import java.util.Arrays; import java.util.function.Consumer; public class PFMExtraModelProvider implements ExtraModelProvider { @Override public void provideExtraModels(ResourceManager manager, Consumer out) { UnbakedBedModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedBasicTableModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedClassicTableModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedClassicNightstandModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedLogTableModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedDinnerTableModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedModernDinnerTableModel.ALL_MODEL_IDS.forEach(out::accept); + for (Identifier id : UnbakedBasicTableModel.BASIC_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedClassicTableModel.CLASSIC_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedLogTableModel.LOG_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedDinnerTableModel.DINNER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedModernDinnerTableModel.MODERN_DINNER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedClassicNightstandModel.NIGHTSTAND_MODEL_PARTS_BASE) { + out.accept(id); + } UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedKitchenWallCounterModel.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 3770aafd1..b63944f50 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 @@ -35,23 +35,23 @@ public class PFMModelProvider implements ModelResourceProvider { } else if (ModelHelper.containsIdentifier(UnbakedBedModel.BED_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ return new UnbakedBedModel(ModelHelper.getWoodType(resourceId), ModelHelper.getColor(resourceId), new ArrayList<>(), resourceId.getPath().contains("classic")); } - else if (ModelHelper.containsIdentifier(UnbakedBasicTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedBasicTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedBasicTableModel.MODEL_IDS.contains(resourceId)){ + return new UnbakedBasicTableModel(); } - else if (ModelHelper.containsIdentifier(UnbakedClassicTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedClassicTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedClassicTableModel.MODEL_IDS.contains(resourceId)){ + return new UnbakedClassicTableModel(); } - else if (ModelHelper.containsIdentifier(UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedClassicNightstandModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedLogTableModel.TABLE_MODEL_IDS.contains(resourceId)){ + return new UnbakedLogTableModel(); } - else if (ModelHelper.containsIdentifier(UnbakedLogTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedLogTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId), resourceId.getPath().contains("raw")); + else if (UnbakedDinnerTableModel.TABLE_MODEL_IDS.contains(resourceId)){ + return new UnbakedDinnerTableModel(); } - else if (ModelHelper.containsIdentifier(UnbakedDinnerTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedDinnerTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.contains(resourceId)){ + return new UnbakedModernDinnerTableModel(); } - else if (ModelHelper.containsIdentifier(UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedModernDinnerTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.contains(resourceId)){ + return new UnbakedClassicNightstandModel(); } else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ return new UnbakedKitchenCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/shape/BlockPortalShape.java b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/shape/BlockPortalShape.java index 74f4b24b8..fb089f725 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/shape/BlockPortalShape.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/fabric/shape/BlockPortalShape.java @@ -160,7 +160,7 @@ public void calcFrameArea() { firstFramePos = frameAreaWithoutCorner.iterator().next(); } - //null for not found + // null for not found @Nullable public static BlockPortalShape findArea( BlockPos startingPos, @@ -227,7 +227,7 @@ private static boolean findAreaBreadthFirst( foundArea.add(curr); } else if (isObsidian.test(curr)) { - //nothing happens + // nothing happens } else { return false; @@ -279,7 +279,7 @@ private static boolean findAreaRecursively( } else { if (!isObsidian.test(newPos)) { - //abort + // abort return false; } } @@ -288,7 +288,7 @@ private static boolean findAreaRecursively( return true; } - //return null for not match + // return null for not match public BlockPortalShape matchShape( Predicate isAir, Predicate isObsidian, @@ -311,7 +311,7 @@ public BlockPortalShape matchShape( blockPos.getY() - anchor.getY() + newAnchor.getY(), blockPos.getZ() - anchor.getZ() + newAnchor.getZ() ) - //blockPos.subtract(anchor).add(newAnchor) + // blockPos.subtract(anchor).add(newAnchor) ).allMatch( isAir ); @@ -334,7 +334,7 @@ private boolean testFrameWithoutCorner( blockPos.getZ() - anchor.getZ() + newAnchor.getZ() ); - //does this have optimization effect? + // does this have optimization effect? if (!isObsidian.test(mapper.apply(firstFramePos))) { return false; } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java index 7c717a2ba..4a099b015 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java @@ -91,7 +91,7 @@ public void onInitialize() { PaladinFurnitureModFabric.initializeItemGroup(); BlockItemRegistryFabric.registerItems(); BlockItemRegistryFabric.registerBlocks(); - //PFMRuntimeResources.prepareAsyncResourceGen(); No async gen because Forge won't behave, blame it. + // PFMRuntimeResources.prepareAsyncResourceGen(); No async gen because Forge won't behave, blame it. StatisticsRegistryFabric.registerStatistics(); SoundRegistryFabric.registerSounds(); NetworkRegistryFabric.registerPackets(); @@ -104,12 +104,12 @@ public void onInitialize() { public static void onServerJoin(ServerPlayNetworkHandler handler, PacketSender sender, MinecraftServer server) { - //Give book + // Give book if (getPFMConfig().shouldGiveGuideBook()) { PFMCriteria.GUIDE_BOOK_CRITERION.trigger(handler.getPlayer()); } - //Sync Config + // Sync Config PacketByteBuf buffer = new PacketByteBuf(Unpooled.buffer()); Collection configOptions = PaladinFurnitureMod.getPFMConfig().options.values(); buffer.writeCollection(configOptions, AbstractConfigOption::writeConfigOption); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMBlockModelsMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMBlockModelsMixin.java new file mode 100644 index 000000000..2ed65afab --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMBlockModelsMixin.java @@ -0,0 +1,25 @@ +package com.unlikepaladin.pfm.mixin.fabric; + +import com.unlikepaladin.pfm.client.fabric.PFMBakedModelParticleExtension; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.block.BlockModels; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.texture.Sprite; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(BlockModels.class) +public abstract class PFMBlockModelsMixin { + @Shadow public abstract BakedModel getModel(BlockState state); + + @Inject(method = "getModelParticleSprite", at = @At("HEAD"), cancellable = true) + public void setCustomModelParticle(BlockState state, CallbackInfoReturnable cir) { + BakedModel model = this.getModel(state); + if (model instanceof PFMBakedModelParticleExtension) { + cir.setReturnValue(((PFMBakedModelParticleExtension) model).pfm$getParticle(state)); + } + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java new file mode 100644 index 000000000..2d4ee687a --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java @@ -0,0 +1,33 @@ +package com.unlikepaladin.pfm.mixin.fabric; + +import com.unlikepaladin.pfm.client.fabric.PFMBakedModelParticleExtension; +import net.minecraft.block.BlockState; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.particle.CrackParticle; +import net.minecraft.client.particle.SpriteBillboardParticle; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(CrackParticle.class) +public abstract class PFMCrackParticleMixin extends SpriteBillboardParticle { + protected PFMCrackParticleMixin(ClientWorld clientWorld, double d, double e, double f) { + super(clientWorld, d, e, f); + } + + @Inject(method = "(Lnet/minecraft/client/world/ClientWorld;DDDLnet/minecraft/item/ItemStack;)V", at = @At("TAIL")) + public void setCustomModelParticle(ClientWorld world, double x, double y, double z, ItemStack stack, CallbackInfo ci){ + if (stack.getItem() instanceof BlockItem) { + BlockState defaultState = ((BlockItem)stack.getItem()).getBlock().getDefaultState(); + BakedModel model = MinecraftClient.getInstance().getBakedModelManager().getBlockModels().getModel(defaultState); + if (model instanceof PFMBakedModelParticleExtension) { + this.setSprite(((PFMBakedModelParticleExtension) model).pfm$getParticle(defaultState)); + } + } + } +} diff --git a/fabric/src/main/resources/pfm.mixins.json b/fabric/src/main/resources/pfm.mixins.json index 0fe888398..b69db612a 100755 --- a/fabric/src/main/resources/pfm.mixins.json +++ b/fabric/src/main/resources/pfm.mixins.json @@ -3,12 +3,14 @@ "package": "com.unlikepaladin.pfm.mixin.fabric", "compatibilityLevel": "JAVA_8", "client": [ + "PFMBlockModelsMixin", + "PFMCrackParticleMixin", "PFMTitleScreenMixin" ], "mixins": [ "PFMCookingPotBlockEntityMixin", - "PFMReloadableResourceManagerImplMixin", - "PFMModResourcePackCreatorMixin" + "PFMModResourcePackCreatorMixin", + "PFMReloadableResourceManagerImplMixin" ], "injectors": { "defaultRequire": 1 diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/forge/StoveBlockImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/forge/StoveBlockImpl.java index 2c9fdece5..7ba301962 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/forge/StoveBlockImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/forge/StoveBlockImpl.java @@ -30,7 +30,7 @@ public static void openMenuScreen(World world, BlockPos pos, PlayerEntity player } else { NamedScreenHandlerFactory screenHandlerFactory = world.getBlockState(pos).createScreenHandlerFactory(world, pos); if (screenHandlerFactory != null) { - //With this call the server will request the client to open the appropriate Screenhandler + // With this call the server will request the client to open the appropriate Screenhandler player.openHandledScreen(screenHandlerFactory); player.incrementStat(Statistics.STOVE_OPENED); } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java index 92d0708c6..9e9512934 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java @@ -33,7 +33,7 @@ public class ForgeBasicLampModel extends AbstractBakedModel { private final Map> bakedModels; private final Map textureMap; public ForgeBasicLampModel(Map textures, ModelBakeSettings settings, Map> bakedModels, List modelParts) { - super(textures.get(WoodVariantRegistry.OAK), settings, new HashMap<>()); + super(settings, bakedModels.get(WoodVariantRegistry.OAK).values().stream().toList()); this.modelParts = modelParts; this.textureMap = textures; this.bakedModels = bakedModels; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java index 028f21299..b251cc287 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/ForgeBasicTableModel.java @@ -1,13 +1,15 @@ package com.unlikepaladin.pfm.blocks.models.basicTable.forge; import com.unlikepaladin.pfm.blocks.BasicTableBlock; -import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.client.forge.PFMBakedModelGetQuadsExtension; 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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,19 +21,28 @@ import java.util.*; -public class ForgeBasicTableModel extends AbstractBakedModel { - public ForgeBasicTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeBasicTableModel extends PFMForgeBakedModel { + public ForgeBasicTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof BasicTableBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + BasicTableBlock block = (BasicTableBlock) state.getBlock(); boolean north = block.canConnect(world, state, pos.north(), pos); boolean east = block.canConnect(world, state, pos.east(), pos); @@ -50,15 +61,18 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos set.set(5, cornerNorthEast); set.set(6, cornerSouthEast); set.set(7, cornerSouthWest); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof BasicTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List baseQuads = new ArrayList<>(); + List secondaryQuads = new ArrayList<>(); + BitSet set = extraData.getData(CONNECTIONS).connections; boolean north = set.get(0); boolean east = set.get(1); @@ -69,122 +83,148 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean cornerSouthEast = set.get(6); boolean cornerSouthWest = set.get(7); Direction.Axis dir = state.get(BasicTableBlock.AXIS); - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + baseQuads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); if (!north && !south && !east && !west) { - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(8).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, side, rand, extraData)); } if (dir == Direction.Axis.Z) { if (!north && !east) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (!north && !west) { - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (!south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } if (!south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (!north && south && !east && !west) { - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, side, rand, extraData)); } if (north && !south && !east && !west) { - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(8).getQuads(state, side, rand, extraData)); } if (!north && east && !west) { - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData)); } if (!south && !east && west) { - quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(10).getQuads(state, side, rand, extraData)); } if (!south && east && !west) { - quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(9).getQuads(state, side, rand, extraData)); } if (!north && !east && west) { - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData)); } if (!north && east && west) { - quads.addAll(getBakedModels().get(modelParts.get(12)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(12).getQuads(state, side, rand, extraData)); } if (!south && east && west) { - quads.addAll(getBakedModels().get(modelParts.get(11)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(11).getQuads(state, side, rand, extraData)); } if (cornerNorthEast) { - quads.addAll(getBakedModels().get(modelParts.get(13)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(13).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (cornerNorthWest) { - quads.addAll(getBakedModels().get(modelParts.get(14)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(14).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (cornerSouthWest) { - quads.addAll(getBakedModels().get(modelParts.get(16)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(16).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (cornerSouthEast) { - quads.addAll(getBakedModels().get(modelParts.get(15)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(15).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } } else { if (!north && !east) { - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (!north && !west) { - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (!south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (!south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } if (!north && south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(9).getQuads(state, side, rand, extraData)); } if (north && !south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(10).getQuads(state, side, rand, extraData)); } if (!north && south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData)); } if (north && !south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData)); } if (!north && !south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, side, rand, extraData)); } if (!north && !south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(8).getQuads(state, side, rand, extraData)); } if (north && south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(12)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(12).getQuads(state, side, rand, extraData)); } if (north && south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(11)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(11).getQuads(state, side, rand, extraData)); } if (cornerNorthEast) { - quads.addAll(getBakedModels().get(modelParts.get(14)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(14).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (cornerSouthEast) { - quads.addAll(getBakedModels().get(modelParts.get(13)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(13).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (cornerNorthWest) { - quads.addAll(getBakedModels().get(modelParts.get(16)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(16).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (cornerSouthWest) { - quads.addAll(getBakedModels().get(modelParts.get(15)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(15).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } } + List spriteList = getSpriteList(state); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + return quads; } + return Collections.emptyList(); + } + + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + // base + List baseQuads = new ArrayList<>(getTemplateBakedModels().get(0).getQuads(state, face, random)); + + List secondaryQuads = new ArrayList<>(); + // legs + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, face, random)); + // in between pieces + secondaryQuads.addAll(getTemplateBakedModels().get(8).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(7).getQuads(state, face, random)); + + List spriteList = getSpriteList(stack); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java index 8d805e185..c31845be0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicTable/forge/UnbakedBasicTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeBasicTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeBasicTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java index 4824d3167..54cd71124 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java @@ -5,6 +5,7 @@ import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.bed.BedInterface; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.BedBlock; import net.minecraft.block.BlockState; import net.minecraft.block.enums.BedPart; @@ -23,9 +24,9 @@ import java.util.*; -public class ForgeBedModel extends AbstractBakedModel implements BedInterface { +public class ForgeBedModel extends PFMForgeBakedModel implements BedInterface { public ForgeBedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -43,31 +44,31 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean right = data.get(1); boolean bunk = data.get(2); if (part == BedPart.HEAD) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData)); } if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(7).getQuads(state, side, rand, extraData)); } if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - quads.addAll(getBakedModels().get(modelParts.get(10)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(10).getQuads(state, side, rand, extraData)); } } else { - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); if (!right){ - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (!left){ - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData)); } if (!right && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(8).getQuads(state, side, rand, extraData)); } if (!left && bunk){ - quads.addAll(getBakedModels().get(modelParts.get(9)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(9).getQuads(state, side, rand, extraData)); } } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java index cfdb607e0..ca32f1dd0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java @@ -2,12 +2,15 @@ import com.unlikepaladin.pfm.blocks.ClassicNightstandBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,43 +22,53 @@ import java.util.*; -public class ForgeClassicNightstandModel extends AbstractBakedModel { - private final List modelParts; +public class ForgeClassicNightstandModel extends PFMForgeBakedModel { - public ForgeClassicNightstandModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); - this.modelParts = modelParts; + public ForgeClassicNightstandModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List originalQuads = new ArrayList<>(); BitSet data = extraData.getData(CONNECTIONS).connections; boolean left = data.get(0); boolean right = data.get(1); int openIndexOffset = state.get(ClassicNightstandBlock.OPEN) ? 4 : 0; if (left && right) { - quads.addAll(getBakedModels().get(modelParts.get(openIndexOffset)).getQuads(state, side, rand, extraData)); + originalQuads.addAll(getTemplateBakedModels().get(openIndexOffset).getQuads(state, side, rand, extraData)); } else if (!left && right) { - quads.addAll(getBakedModels().get(modelParts.get(1+openIndexOffset)).getQuads(state, side, rand, extraData)); + originalQuads.addAll(getTemplateBakedModels().get(1+openIndexOffset).getQuads(state, side, rand, extraData)); } else if (left) { - quads.addAll(getBakedModels().get(modelParts.get(2+openIndexOffset)).getQuads(state, side, rand, extraData)); + originalQuads.addAll(getTemplateBakedModels().get(2+openIndexOffset).getQuads(state, side, rand, extraData)); } else { - quads.addAll(getBakedModels().get(modelParts.get(3+openIndexOffset)).getQuads(state, side, rand, extraData)); + originalQuads.addAll(getTemplateBakedModels().get(3+openIndexOffset).getQuads(state, side, rand, extraData)); } + List spriteList = getSpriteList(state); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakSprites(), spriteList); } - return quads; + return Collections.emptyList(); } public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof ClassicNightstandBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + ClassicNightstandBlock block = (ClassicNightstandBlock) state.getBlock(); Direction dir = state.get(ClassicNightstandBlock.FACING); boolean left = block.isStand(world, pos, dir.rotateYCounterclockwise(), dir); @@ -63,8 +76,16 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, left); set.set(1, right); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(stack); + List originalQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakSprites(), spriteList); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java index 38dc8c8be..0e66b54cd 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/UnbakedClassicNightstandModelImpl.java @@ -1,14 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.classicNightstand.forge; +import com.unlikepaladin.pfm.blocks.models.classicTable.forge.ForgeClassicTableModel; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicNightstandModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeClassicNightstandModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeClassicNightstandModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java index a90fa60af..4d4b74f00 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/ForgeClassicTableModel.java @@ -3,11 +3,13 @@ import com.unlikepaladin.pfm.blocks.ClassicTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,19 +21,28 @@ import java.util.*; -public class ForgeClassicTableModel extends AbstractBakedModel { - public ForgeClassicTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeClassicTableModel extends PFMForgeBakedModel { + public ForgeClassicTableModel(ModelBakeSettings settings, List parts) { + super(settings, parts); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof ClassicTableBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + ClassicTableBlock block = (ClassicTableBlock) state.getBlock(); boolean north = block.canConnect(world.getBlockState(pos.north())); boolean east = block.canConnect(world.getBlockState(pos.east())); @@ -42,33 +53,60 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos set.set(1, east); set.set(2, west); set.set(3, south); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof ClassicTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { BitSet set = extraData.getData(CONNECTIONS).connections; + List baseQuads = new ArrayList<>(); + List secondaryQuads = new ArrayList<>(); + boolean north = set.get(0); boolean east = set.get(1); boolean west = set.get(2); boolean south = set.get(3); - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + baseQuads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); if (!north && !east) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (!north && !west) { - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (!south && !west) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } if (!south && !east) { - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); } + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); + } + + List spriteList = getSpriteList(state); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + return quads; } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + // base + List baseQuads = new ArrayList<>(getTemplateBakedModels().get(0).getQuads(state, face, random)); + + List secondaryQuads = new ArrayList<>(); + // legs + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, face, random)); + secondaryQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, face, random)); + + List spriteList = getSpriteList(stack); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java index 732878152..53d30cf77 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicTable/forge/UnbakedClassicTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedClassicTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeClassicTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeClassicTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java index b89a792a5..e379f3699 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/ForgeDinnerTableModel.java @@ -3,11 +3,13 @@ import com.unlikepaladin.pfm.blocks.DinnerTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,19 +21,28 @@ import java.util.*; -public class ForgeDinnerTableModel extends AbstractBakedModel { - public ForgeDinnerTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeDinnerTableModel extends PFMForgeBakedModel { + public ForgeDinnerTableModel(ModelBakeSettings settings, List modelList) { + super(settings, modelList); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof DinnerTableBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + DinnerTableBlock block = (DinnerTableBlock) state.getBlock(); Direction dir = state.get(DinnerTableBlock.FACING); boolean left = block.isTable(world, pos, dir.rotateYCounterclockwise(), dir); @@ -39,32 +50,52 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, left); set.set(1, right); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof DinnerTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List baseQuads = new ArrayList<>(); + List secondaryQuads = new ArrayList<>(); + BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); Direction dir = state.get(DinnerTableBlock.FACING); - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + baseQuads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); if (!left) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 1 : 2; - quads.addAll(getBakedModels().get(modelParts.get(index)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(index).getQuads(state, side, rand, extraData)); } if (!right) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 2 : 1; - quads.addAll(getBakedModels().get(modelParts.get(index)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(index).getQuads(state, side, rand, extraData)); } if (!right && !left) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } + List spriteList = getSpriteList(state); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + return quads; } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + // base + List baseQuads = new ArrayList<>(getTemplateBakedModels().get(0).getQuads(state, face, random)); + // legs + List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); + + List spriteList = getSpriteList(stack); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java index 4fd25e843..68347ffb3 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/dinnerTable/forge/UnbakedDinnerTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedDinnerTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeDinnerTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeDinnerTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java new file mode 100644 index 000000000..5d8bcfe9c --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -0,0 +1,148 @@ +package com.unlikepaladin.pfm.blocks.models.forge; + +import com.mojang.datafixers.util.Pair; +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.client.forge.PFMBakedModelGetQuadsExtension; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.VertexFormatElement; +import net.minecraft.client.render.VertexFormats; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import net.minecraftforge.client.model.pipeline.LightUtil; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +public abstract class PFMForgeBakedModel extends AbstractBakedModel implements PFMBakedModelGetQuadsExtension { + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + return getQuads(state, face, random); + } + + public PFMForgeBakedModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + public static ModelProperty STATE = new ModelProperty<>(); + + @NotNull + @Override + public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + tileData.setData(STATE, state); + return tileData; + } + + Map> separatedQuads = new ConcurrentHashMap<>(); + public List getQuadsWithTexture(List quads, List toReplace, List replacements) { + if (toReplace.size() != replacements.size()) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list is not the same size, skipping transformation"); + return quads; + } + if (toReplace.equals(replacements)) + return quads; + + for (BakedQuad quad : quads) { + Sprite sprite = quad.getSprite(); + if (separatedQuads.containsKey(sprite)) { + if (!separatedQuads.get(sprite).contains(quad)) + separatedQuads.get(sprite).add(quad); + continue; + } + List list = new ArrayList<>(); + separatedQuads.put(sprite, list); + } + + List transformedQuads = new ArrayList<>(quads.size()); + for (Map.Entry> entry : separatedQuads.entrySet()) { + if (toReplace.contains(entry.getKey())) { + int i = toReplace.indexOf(entry.getKey()); + Sprite replacement = replacements.get(i); + transformedQuads.addAll(getQuadsWithTexture(entry.getValue().stream().filter(quads::contains).toList(), replacement)); + } else { + transformedQuads.addAll(entry.getValue().stream().filter(quads::contains).toList()); + } + } + return transformedQuads; + } + + Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); + public List getQuadsWithTexture(List quads, Sprite sprite) { + List transformedQuads = new ArrayList<>(quads.size()); + + // UV Element index + int uvVertexIndx = findVertexElement(VertexFormatElement.Type.UV, 0); + + quads.forEach(quad -> { + Pair quadKey = new Pair<>(sprite, quad); + if (quad.getSprite() == sprite && !quadToTransformedQuad.containsKey(quadKey)) { + quadToTransformedQuad.put(quadKey, quad); + transformedQuads.add(quad); + } + else if (quadToTransformedQuad.containsKey(quadKey)) { + transformedQuads.add(quadToTransformedQuad.get(quadKey)); + } + else { + int[] vertexData = new int[quad.getVertexData().length]; + System.arraycopy(quad.getVertexData(), 0, vertexData, 0, vertexData.length); + float[][] uv = new float[4][2]; + for (int vertexIndx = 0; vertexIndx < 4; vertexIndx++) { + LightUtil.unpack(vertexData, uv[vertexIndx], VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, vertexIndx, uvVertexIndx); + Sprite originalSprite = quad.getSprite(); + float frameU = originalSprite.method_35804(uv[vertexIndx][0]); + float frameV = originalSprite.method_35805(uv[vertexIndx][1]); + uv[vertexIndx][0] = sprite.getFrameU(frameU); + uv[vertexIndx][1] = sprite.getFrameV(frameV); + LightUtil.pack(uv[vertexIndx], vertexData, VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL, vertexIndx, uvVertexIndx); + } + BakedQuad transformedQuad = new BakedQuad(vertexData, quad.getColorIndex(), quad.getFace(), quad.getSprite(), quad.hasShade()); + quadToTransformedQuad.put(quadKey, transformedQuad); + transformedQuads.add(transformedQuad); + } + }); + return transformedQuads; + } + + private static final Map, Integer> ELEMENT_INTEGER_MAP = new HashMap<>(); + public static int findVertexElement(VertexFormatElement.Type type, int index) { + Pair pairToFind = new Pair<>(type, index); + if (ELEMENT_INTEGER_MAP.containsKey(pairToFind)) + return ELEMENT_INTEGER_MAP.get(pairToFind); + + int id = 0; + for (VertexFormatElement element1 : VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL.getElements()) + { + if (element1.getType() == type && element1.getTextureIndex() == index) + break; + id++; + } + ELEMENT_INTEGER_MAP.put(pairToFind, id); + return id; + } + + @Override + public Sprite getParticleIcon(@NotNull IModelData data) { + if (data.hasProperty(STATE) && data.getData(STATE) != null) + return getSpriteList(data.getData(STATE)).get(0); + return super.getParticleIcon(data); + } + + @Override + public Sprite getParticleSprite() { + return getTemplateBakedModels().get(0).getParticleSprite(); + } + + public void appendProperties(ModelDataMap.Builder builder) { + builder.withProperty(STATE); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java index 7f83086c0..15f8e0911 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFreezerModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.FridgeBlock; import com.unlikepaladin.pfm.blocks.IronFridgeBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +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; @@ -23,10 +24,10 @@ import java.util.Map; import java.util.Random; -public class ForgeFreezerModel extends AbstractBakedModel { +public class ForgeFreezerModel extends PFMForgeBakedModel { private final List modelParts; public ForgeFreezerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } @@ -38,9 +39,9 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Boolean hasFridge = extraData.getData(HAS_FRIDGE_PROPERTY); int openOffset = state.get(FreezerBlock.OPEN) ? 2 : 0; if (Boolean.TRUE.equals(hasFridge)) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData)); } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData)); } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java index 7e79556c6..2261579ad 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeFridgeModel.java @@ -5,6 +5,7 @@ import com.unlikepaladin.pfm.blocks.IronFridgeBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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; @@ -21,10 +22,10 @@ import java.util.*; -public class ForgeFridgeModel extends AbstractBakedModel { +public class ForgeFridgeModel extends PFMForgeBakedModel { private final List modelParts; public ForgeFridgeModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } @@ -39,18 +40,18 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean hasFreezer = data.get(2); int openOffset = state.get(FridgeBlock.OPEN) ? 6 : 0; if (top && hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(5+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(5+openOffset).getQuads(state, side, rand, extraData)); } else if (top && bottom) { - quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(2+openOffset).getQuads(state, side, rand, extraData)); } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(3+openOffset).getQuads(state, side, rand, extraData)); } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData)); } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(4+openOffset).getQuads(state, side, rand, extraData)); } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData)); } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java index 14ea564d1..c8372ba7d 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/fridge/forge/ForgeIronFridgeModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.IronFreezerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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; @@ -20,11 +21,11 @@ import java.util.*; -public class ForgeIronFridgeModel extends AbstractBakedModel { +public class ForgeIronFridgeModel extends PFMForgeBakedModel { private final List modelParts; public ForgeIronFridgeModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } @@ -39,15 +40,15 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean hasFreezer = data.get(2); int openOffset = state.get(FridgeBlock.OPEN) ? 5 : 0; if (top && bottom) { - quads.addAll(getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(2+openOffset).getQuads(state, side, rand, extraData)); } else if (bottom) { - quads.addAll(getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(3+openOffset).getQuads(state, side, rand, extraData)); } else if (top) { - quads.addAll(getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData)); } else if (hasFreezer) { - quads.addAll(getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(4+openOffset).getQuads(state, side, rand, extraData)); } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData)); } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java index 3b11cc1e5..d496c4b30 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java @@ -4,6 +4,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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; @@ -21,9 +22,9 @@ import java.util.*; -public class ForgeKitchenCabinetModel extends AbstractBakedModel { +public class ForgeKitchenCabinetModel extends PFMForgeBakedModel { public ForgeKitchenCabinetModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -78,20 +79,20 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean isNeighborStateOppositeFacingDifferentDirection = set.get(1); if (block.isCabinet(blockState) && (direction2 = blockState.get(KitchenCabinetBlock.FACING)).getAxis() != state.get(KitchenCabinetBlock.FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(3 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(3 + openOffset).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(4 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(4 + openOffset).getQuads(state, side, rand, extraData); } } else if (innerCorner) { if (direction3 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(2 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(2 + openOffset).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(1 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(1 + openOffset).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); } } return Collections.emptyList(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java index 391ddc901..fb3dc2403 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; @@ -21,12 +22,10 @@ import java.util.*; -public class ForgeKitchenCounterModel extends AbstractBakedModel { - public ForgeKitchenCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeKitchenCounterModel extends PFMForgeBakedModel { + public ForgeKitchenCounterModel(Sprite frame, ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); @@ -91,10 +90,10 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData); } } else { return getMiddleQuads(state, side, rand, extraData, left, right); @@ -110,9 +109,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData); } } else { return getMiddleQuads(state, side, rand, extraData, left, right); @@ -127,13 +126,13 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi private List getMiddleQuads(BlockState state, Direction side, Random rand, IModelData extraData, boolean left, boolean right) { if (left && right) { - return getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); } else if (left) { - return getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData); } else if (right) { - return getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); } } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java index 208e88fa5..5b48b5b00 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java @@ -9,6 +9,6 @@ public class UnbakedKitchenCounterModelImpl { public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenCounterModel(frame, settings, bakedModels, MODEL_PARTS); + return new ForgeKitchenCounterModel(frame, settings, bakedModels.values().stream().toList()); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java index 870caf57c..2e68e5ae5 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterOvenBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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; @@ -19,10 +20,10 @@ import java.util.*; -public class ForgeKitchenCounterOvenModel extends AbstractBakedModel { +public class ForgeKitchenCounterOvenModel extends PFMForgeBakedModel { private final List modelParts; public ForgeKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = modelParts; } @@ -34,9 +35,9 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction BitSet data = extraData.getData(CONNECTIONS).connections; int openOffset = state.get(KitchenCounterOvenBlock.OPEN) ? 2 : 0; if (data.get(0) || data.get(1)) { - quads.addAll(getBakedModels().get(modelParts.get(1 + openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1 + openOffset).getQuads(state, side, rand, extraData)); } else { - quads.addAll(getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData)); } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java index 27c9a51e2..3338e6fab 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; @@ -21,9 +22,9 @@ import java.util.*; -public class ForgeKitchenDrawerModel extends AbstractBakedModel { +public class ForgeKitchenDrawerModel extends PFMForgeBakedModel { public ForgeKitchenDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -90,10 +91,10 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(5 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((5 + openOffset)).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(6 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((6 + openOffset)).getQuads(state, side, rand, extraData); } } else { return getMiddleQuads(state, side, rand, extraData, left, right, openOffset); @@ -109,9 +110,9 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(4 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((4 + openOffset)).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(3 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((3 + openOffset)).getQuads(state, side, rand, extraData); } } else { return getMiddleQuads(state, side, rand, extraData, left, right, openOffset); @@ -125,13 +126,13 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi private List getMiddleQuads(BlockState state, Direction side, Random rand, IModelData extraData, boolean left, boolean right, int openOffset) { if (left && right) { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((openOffset)).getQuads(state, side, rand, extraData); } else if (left) { - return getBakedModels().get(modelParts.get(1 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((1 + openOffset)).getQuads(state, side, rand, extraData); } else if (right) { - return getBakedModels().get(modelParts.get(2 + openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((2 + openOffset)).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get((openOffset)).getQuads(state, side, rand, extraData); } } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java index 2a9bb4f12..20e3fc13c 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; @@ -21,9 +22,9 @@ import java.util.*; -public class ForgeKitchenWallCounterModel extends AbstractBakedModel { +public class ForgeKitchenWallCounterModel extends PFMForgeBakedModel { public ForgeKitchenWallCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -84,13 +85,13 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -103,16 +104,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); } } return Collections.emptyList(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java index 48c491986..58bfb75dd 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; import net.minecraft.client.render.model.BakedModel; @@ -21,9 +22,9 @@ import java.util.*; -public class ForgeKitchenWallDrawerModel extends AbstractBakedModel { +public class ForgeKitchenWallDrawerModel extends PFMForgeBakedModel { public ForgeKitchenWallDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; } private final List modelParts; @@ -84,13 +85,13 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(3+openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(3+openOffset).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(4+openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(4+openOffset).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -103,16 +104,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getBakedModels().get(modelParts.get(2+openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(2+openOffset).getQuads(state, side, rand, extraData); } else { - return getBakedModels().get(modelParts.get(1+openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); } } else { - return getBakedModels().get(modelParts.get(openOffset)).getQuads(state, side, rand, extraData); + return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); } } return Collections.emptyList(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java index 26e010c45..64724b3bb 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/ForgeLogTableModel.java @@ -3,11 +3,13 @@ import com.unlikepaladin.pfm.blocks.LogTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -18,19 +20,28 @@ import org.jetbrains.annotations.Nullable; import java.util.*; -public class ForgeLogTableModel extends AbstractBakedModel { - public ForgeLogTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeLogTableModel extends PFMForgeBakedModel { + public ForgeLogTableModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } + @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof LogTableBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + LogTableBlock block = (LogTableBlock) state.getBlock(); Direction dir = state.get(LogTableBlock.FACING); boolean left = block.isTable(world, pos, dir.rotateYCounterclockwise(), dir); @@ -38,32 +49,52 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, left); set.set(1, right); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof LogTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List baseQuads = new ArrayList<>(); + List secondaryQuads = new ArrayList<>(); + BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); Direction dir = state.get(LogTableBlock.FACING); - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + baseQuads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); if (!left && right) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 1 : 2; - quads.addAll(getBakedModels().get(modelParts.get(index)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(index).getQuads(state, side, rand, extraData)); } if (!right && left) { int index = dir == Direction.NORTH || dir == Direction.WEST ? 2 : 1; - quads.addAll(getBakedModels().get(modelParts.get(index)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(index).getQuads(state, side, rand, extraData)); } if (!right && !left) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } + List spriteList = getSpriteList(state); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + return quads; } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + // base + List baseQuads = new ArrayList<>(getTemplateBakedModels().get(0).getQuads(state, face, random)); + // legs + List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); + + List spriteList = getSpriteList(stack); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java index 1d397f604..9cc756c27 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logTable/forge/UnbakedLogTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedLogTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeLogTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeLogTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java index fa84db97a..7023c4ccd 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/mirror/forge/ForgeMirrorModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.MirrorBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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; @@ -19,9 +20,9 @@ import java.util.*; -public class ForgeMirrorModel extends AbstractBakedModel { +public class ForgeMirrorModel extends PFMForgeBakedModel { public ForgeMirrorModel(Sprite frame, Sprite glassTex, Sprite reflectTex, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); + super(settings, bakedModels.values().stream().toList()); this.modelParts = MODEL_PARTS; this.glassTex = glassTex; this.reflectTex = reflectTex; @@ -35,32 +36,32 @@ public ForgeMirrorModel(Sprite frame, Sprite glassTex, Sprite reflectTex, ModelB @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + List quads = new ArrayList<>(getTemplateBakedModels().get((0)).getQuads(state, side, rand, extraData)); if (state != null && state.getBlock() instanceof MirrorBlock && extraData.getData(DIRECTIONS) != null && extraData.getData(DIRECTIONS).connections != null) { BitSet connections = extraData.getData(DIRECTIONS).connections; if (!connections.get(0)) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((1)).getQuads(state, side, rand, extraData)); } if (!connections.get(1)) { - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((2)).getQuads(state, side, rand, extraData)); } if (!connections.get(2)) { - quads.addAll(getBakedModels().get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((4)).getQuads(state, side, rand, extraData)); } if (!connections.get(3)) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((3)).getQuads(state, side, rand, extraData)); } if (!connections.get(4)) { - quads.addAll(getBakedModels().get(modelParts.get(6)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((6)).getQuads(state, side, rand, extraData)); } if (!connections.get(5)) { - quads.addAll(getBakedModels().get(modelParts.get(8)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((8)).getQuads(state, side, rand, extraData)); } if (!connections.get(6)) { - quads.addAll(getBakedModels().get(modelParts.get(5)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((5)).getQuads(state, side, rand, extraData)); } if (!connections.get(7)) { - quads.addAll(getBakedModels().get(modelParts.get(7)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get((7)).getQuads(state, side, rand, extraData)); } } return quads; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java index 880bba45e..d5fa630e4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/ForgeModernDinnerTableModel.java @@ -3,11 +3,13 @@ import com.unlikepaladin.pfm.blocks.ModernDinnerTableBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -19,19 +21,28 @@ import java.util.*; -public class ForgeModernDinnerTableModel extends AbstractBakedModel { - public ForgeModernDinnerTableModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(frame, settings, bakedModels); - this.modelParts = MODEL_PARTS; +public class ForgeModernDinnerTableModel extends PFMForgeBakedModel { + public ForgeModernDinnerTableModel(ModelBakeSettings settings, List modelList) { + super(settings, modelList); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof ModernDinnerTableBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + ModernDinnerTableBlock block = (ModernDinnerTableBlock) state.getBlock(); Direction.Axis dir = state.get(ModernDinnerTableBlock.AXIS); boolean left = block.isTable(world, pos, dir, -1); @@ -39,31 +50,52 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, left); set.set(1, right); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof ModernDinnerTableBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List baseQuads = new ArrayList<>(); + List secondaryQuads = new ArrayList<>(); + BitSet set = extraData.getData(CONNECTIONS).connections; boolean left = set.get(0); boolean right = set.get(1); + baseQuads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); if (left && right) { - quads.addAll(getBakedModels().get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + baseQuads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } if (!left && right) { - quads.addAll(getBakedModels().get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } if (!right && left) { - quads.addAll(getBakedModels().get(modelParts.get(2)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); } if (!right && !left) { - quads.addAll(getBakedModels().get(modelParts.get(3)).getQuads(state, side, rand, extraData)); + secondaryQuads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); } + List spriteList = getSpriteList(state); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); + return quads; } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + // base + List baseQuads = new ArrayList<>(getTemplateBakedModels().get(0).getQuads(state, face, random)); + // legs + List secondaryQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); + + List spriteList = getSpriteList(stack); + List quads = getQuadsWithTexture(baseQuads, spriteList.get(0)); + quads.addAll(getQuadsWithTexture(secondaryQuads, spriteList.get(1))); return quads; } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java index ba6523d26..053ecafbe 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernDinnerTable/forge/UnbakedModernDinnerTableModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedModernDinnerTableModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeModernDinnerTableModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeModernDinnerTableModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java new file mode 100644 index 000000000..2a62f8908 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java @@ -0,0 +1,15 @@ +package com.unlikepaladin.pfm.client.forge; + +import net.minecraft.block.BlockState; +import net.minecraft.client.render.model.BakedQuad; +import net.minecraft.client.texture.Sprite; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Random; + +public interface PFMBakedModelGetQuadsExtension { + List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random); +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java index 8866bdcbd..50f1939c4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java @@ -36,7 +36,6 @@ public PFMItemRenderer() { super(MinecraftClient.getInstance().getBlockEntityRenderDispatcher(), MinecraftClient.getInstance().getEntityModelLoader()); } - static Map> bakedModels = new LinkedHashMap<>(); static List modelParts = new ArrayList<>(); public BakedModel getLampPartFromVariant(WoodVariant variantBase, int index) { 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 ef346faa5..c57e08979 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 @@ -23,6 +23,7 @@ import com.unlikepaladin.pfm.client.screens.*; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; +import net.minecraft.util.Identifier; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.client.model.ModelLoader; @@ -67,12 +68,26 @@ public static KeyBinding registerKey(String name, String category, int keyCode) @SubscribeEvent public static void registerExtraModels(ModelRegistryEvent event) { + UnbakedBedModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedBasicTableModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedClassicTableModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedLogTableModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedDinnerTableModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedModernDinnerTableModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); + for (Identifier id : UnbakedBasicTableModel.BASIC_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedClassicTableModel.CLASSIC_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedLogTableModel.LOG_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedDinnerTableModel.DINNER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedModernDinnerTableModel.MODERN_DINNER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedClassicNightstandModel.NIGHTSTAND_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedKitchenWallCounterModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); @@ -83,7 +98,6 @@ public static void registerExtraModels(ModelRegistryEvent event) { UnbakedIronFridgeModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedFridgeModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedFreezerModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedClassicNightstandModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedBasicLampModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/shape/BlockPortalShape.java b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/shape/BlockPortalShape.java index 0554f80b4..881721493 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/shape/BlockPortalShape.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/forge/shape/BlockPortalShape.java @@ -160,7 +160,7 @@ public void calcFrameArea() { firstFramePos = frameAreaWithoutCorner.iterator().next(); } - //null for not found + // null for not found @Nullable public static BlockPortalShape findArea( BlockPos startingPos, @@ -227,7 +227,7 @@ private static boolean findAreaBreadthFirst( foundArea.add(curr); } else if (isObsidian.test(curr)) { - //nothing happens + // nothing happens } else { return false; @@ -279,7 +279,7 @@ private static boolean findAreaRecursively( } else { if (!isObsidian.test(newPos)) { - //abort + // abort return false; } } @@ -288,7 +288,7 @@ private static boolean findAreaRecursively( return true; } - //return null for not match + // return null for not match public BlockPortalShape matchShape( Predicate isAir, Predicate isObsidian, @@ -311,7 +311,7 @@ public BlockPortalShape matchShape( blockPos.getY() - anchor.getY() + newAnchor.getY(), blockPos.getZ() - anchor.getZ() + newAnchor.getZ() ) - //blockPos.subtract(anchor).add(newAnchor) + // blockPos.subtract(anchor).add(newAnchor) ).allMatch( isAir ); @@ -334,7 +334,7 @@ private boolean testFrameWithoutCorner( blockPos.getZ() - anchor.getZ() + newAnchor.getZ() ); - //does this have optimization effect? + // does this have optimization effect? if (!isObsidian.test(mapper.apply(firstFramePos))) { return false; } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/ItemRendererMixin.java b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/ItemRendererMixin.java new file mode 100644 index 000000000..9bbc75c25 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/ItemRendererMixin.java @@ -0,0 +1,65 @@ +package com.unlikepaladin.pfm.mixin.forge; + +import com.unlikepaladin.pfm.client.forge.PFMBakedModelGetQuadsExtension; +import net.minecraft.block.BlockState; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.RenderLayers; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.BakedQuad; +import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Direction; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.List; +import java.util.Random; + +@Mixin(ItemRenderer.class) +public abstract class ItemRendererMixin { + @Shadow + public abstract void renderBakedItemQuads(MatrixStack matrices, VertexConsumer vertices, List quads, ItemStack stack, int light, int overlay); + + @Shadow + public static VertexConsumer getDirectItemGlintConsumer(VertexConsumerProvider provider, RenderLayer layer, boolean solid, boolean glint) { + throw new AssertionError(); + } + + @Inject(at = @At("HEAD"), method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", cancellable = true) + private void renderPFMItem(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) { + if (!stack.isEmpty() && model instanceof PFMBakedModelGetQuadsExtension) { + matrices.push(); + MatrixStack.Entry pose = matrices.peek(); + model = model.handlePerspective(renderMode, matrices); + matrices.translate(-0.5, -0.5, -0.5); + + BlockState state = stack.getItem() instanceof BlockItem ? ((BlockItem) stack.getItem()).getBlock().getDefaultState() : null; + RenderLayer renderLayer = RenderLayers.getItemLayer(stack, true); + VertexConsumer vertexConsumer = getDirectItemGlintConsumer(vertexConsumers, renderLayer, true, stack.hasGlint()); + + Random random = new Random(); + long randomSeed = 42L; + for (Direction direction : Direction.values()) { + random.setSeed(randomSeed); + this.renderBakedItemQuads(matrices, vertexConsumer, ((PFMBakedModelGetQuadsExtension) model).getQuads(stack, state, direction, random), stack, light, overlay); + } + random.setSeed(randomSeed); + this.renderBakedItemQuads(matrices, vertexConsumer, ((PFMBakedModelGetQuadsExtension)model).getQuads(stack, state, null, random), stack, light, overlay); + + // Conditionally pop because of handlePerspective weirdness + if (matrices.peek() != pose) { + matrices.pop(); + } + matrices.pop(); + ci.cancel(); + } + } +} 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 458367615..f43652f7f 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.modernDinnerTable.UnbakedModernDinnerTableModel; import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; +import net.minecraft.client.util.ModelIdentifier; import net.minecraft.util.Identifier; import org.spongepowered.asm.mixin.*; import org.spongepowered.asm.mixin.injection.At; @@ -31,6 +32,7 @@ import java.util.ArrayList; import java.util.Map; +import java.util.Objects; @Mixin(ModelLoader.class) public abstract class PFMModelLoaderMixin { @@ -39,111 +41,116 @@ public abstract class PFMModelLoaderMixin { @Shadow @Final private Map modelsToBake; + @Inject(method = "loadModel", at = @At("HEAD"), cancellable = true) - private void pfm$addMirrorModel(Identifier resourceId, CallbackInfo ci) { - if (ModelHelper.containsIdentifier(UnbakedMirrorModel.MIRROR_MODEL_IDS, resourceId)){ + private void pfm$loadModels(Identifier resourceId, CallbackInfo ci) { + Identifier modifiedId = resourceId; + if (resourceId instanceof ModelIdentifier && Objects.equals(((ModelIdentifier)resourceId).getVariant(), "inventory")) { + modifiedId = new Identifier(resourceId.getNamespace(), "item/" + resourceId.getPath()); + } + + if (ModelHelper.containsIdentifier(UnbakedMirrorModel.MIRROR_MODEL_IDS, modifiedId)){ UnbakedModel model = new UnbakedMirrorModel(UnbakedMirrorModel.DEFAULT_TEXTURES[2], ModelHelper.getVanillaConcreteColor(resourceId), UnbakedMirrorModel.DEFAULT_TEXTURES[1], new ArrayList<>(), ModelHelper.getColor(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); - } else if (ModelHelper.containsIdentifier(UnbakedBedModel.BED_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + } else if (ModelHelper.containsIdentifier(UnbakedBedModel.BED_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedBedModel(ModelHelper.getWoodType(resourceId), ModelHelper.getColor(resourceId), new ArrayList<>(), resourceId.getPath().contains("classic")); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedBasicTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - UnbakedModel model = new UnbakedBasicTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedBasicTableModel.MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedBasicTableModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedClassicTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - UnbakedModel model = new UnbakedClassicTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedClassicTableModel.MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedClassicTableModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedLogTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - boolean raw = resourceId.getPath().contains("raw"); - UnbakedModel model = new UnbakedLogTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId), raw); + else if (UnbakedLogTableModel.TABLE_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedLogTableModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedDinnerTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - UnbakedModel model = new UnbakedDinnerTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedDinnerTableModel.TABLE_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedDinnerTableModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - UnbakedModel model = new UnbakedModernDinnerTableModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedModernDinnerTableModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenWallCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenWallDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenCabinetModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - UnbakedModel model = new UnbakedClassicNightstandModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedClassicNightstandModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedKitchenCounterOvenModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedIronFridgeModel.IRON_FRIDGE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedIronFridgeModel.IRON_FRIDGE_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedIronFridgeModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedFridgeModel.FRIDGE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedFridgeModel.FRIDGE_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedFridgeModel(resourceId); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedFreezerModel.FREEZER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedFreezerModel.FREEZER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedFreezerModel(resourceId); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedBasicLampModel.LAMP_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (ModelHelper.containsIdentifier(UnbakedBasicLampModel.LAMP_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ UnbakedModel model = new UnbakedBasicLampModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java index 63cc281e7..95d5ff979 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/NetworkRegistryForge.java @@ -31,7 +31,7 @@ public static void registerPackets() { PFM_CHANNEL.registerMessage(++id, ToiletUsePacket.class, ToiletUsePacket::encode, ToiletUsePacket::decode, ToiletUsePacket::handle); PFM_CHANNEL.registerMessage(++id, TrashcanClearPacket.class, TrashcanClearPacket::encode, TrashcanClearPacket::decode, TrashcanClearPacket::handle); PFM_CHANNEL.registerMessage(++id, SyncConfigPacket.class, SyncConfigPacket::encode, SyncConfigPacket::decode, SyncConfigPacket::handle); - //PFM_CHANNEL.registerMessage(++id, ResetConfigPacket.class, ResetConfigPacket::encode, ResetConfigPacket::decode, ResetConfigPacket::handle); + // PFM_CHANNEL.registerMessage(++id, ResetConfigPacket.class, ResetConfigPacket::encode, ResetConfigPacket::decode, ResetConfigPacket::handle); } @SubscribeEvent diff --git a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/RecipeRegistryForge.java b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/RecipeRegistryForge.java index aafd1626e..a102f56f0 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/RecipeRegistryForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/RecipeRegistryForge.java @@ -27,8 +27,8 @@ public static void registerRecipeSerializers(RegistryEvent.Register Date: Wed, 20 Dec 2023 23:43:44 -0600 Subject: [PATCH 02/10] Add some safeguards to data/asset gen and improved retrieval of block textures hopefully --- .../pfm/blocks/models/AbstractBakedModel.java | 7 ++- .../pfm/blocks/models/ModelHelper.java | 57 +++++++++++++++---- .../pfm/data/materials/BlockType.java | 11 +++- .../data/materials/ExtraCounterVariant.java | 2 + .../pfm/data/materials/ExtraStoolVariant.java | 2 + .../pfm/data/materials/StoneVariant.java | 2 + .../data/materials/VariantRegistryBase.java | 4 +- .../pfm/data/materials/WoodVariant.java | 2 +- .../pfm/runtime/PFMAssetGenerator.java | 4 +- .../pfm/runtime/PFMDataGenerator.java | 4 +- .../pfm/runtime/PFMGenerator.java | 18 ++++-- .../classic_nightstand_middle_open.json | 2 +- .../models/fabric/PFMFabricBakedModel.java | 12 +++- .../PFMModResourcePackCreatorMixin.java | 9 ++- .../models/forge/PFMForgeBakedModel.java | 13 ++++- .../pfm/forge/PaladinFurnitureModForge.java | 9 ++- 16 files changed, 119 insertions(+), 39 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 899c5f084..2e249f800 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -1,6 +1,7 @@ package com.unlikepaladin.pfm.blocks.models; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import net.minecraft.block.Block; @@ -129,12 +130,12 @@ private List getSpriteFromState(BlockState state) { boolean stripped = state.getBlock().getTranslationKey().contains("stripped"); List list = new ArrayList<>(3); if (!state.getBlock().getTranslationKey().contains("_raw_")) { - SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId((Block) variant.getChild("stripped_log"))) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getBaseBlock())); - SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getBaseBlock())) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getSecondaryBlock())); + SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PRIMARY)); + SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PRIMARY)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.SECONDARY)); list.add(mainTexture.getSprite()); list.add(secondTexture.getSprite()); } else { - SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId((Block) variant.getChild("stripped_log"))) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(variant.getSecondaryBlock())); + SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.SECONDARY)); list.add(mainTexture.getSprite()); list.add(mainTexture.getSprite()); } 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 535164fd1..78eda9b14 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 @@ -1,5 +1,6 @@ package com.unlikepaladin.pfm.blocks.models; +import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.DyeableFurnitureBlock; import com.unlikepaladin.pfm.data.materials.*; @@ -8,6 +9,8 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.texture.MissingSprite; import net.minecraft.client.texture.Sprite; import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; @@ -17,8 +20,8 @@ import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; -import net.minecraft.util.Pair; import net.minecraft.util.StringIdentifiable; +import net.minecraft.util.math.Direction; import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; @@ -136,14 +139,43 @@ public static Block getWoolColor(String string) { public static Identifier getTextureId(Block block) { return getTextureId(block, ""); } - private static final Map, Identifier> blockToTextureMap = new HashMap<>(); + private static final Map, Pair> blockToTextureMap = new HashMap<>(); public static Identifier getTextureId(Block block, String postfix) { - Pair pair = new Pair<>(block, postfix); + if (postfix.isEmpty()) + postfix = null; + Pair pair = new Pair<>(block.toString(), postfix); + if (blockToTextureMap.containsKey(pair) && (blockToTextureMap.get(pair).getFirst() != MissingSprite.getMissingSpriteId() || blockToTextureMap.get(pair).getSecond() > 3)) { + return blockToTextureMap.get(pair).getFirst(); + } + int attemptNum = 1; if (blockToTextureMap.containsKey(pair)) { - return blockToTextureMap.get(pair); + attemptNum += blockToTextureMap.get(pair).getSecond(); } + if (postfix == null) + postfix = ""; + Identifier id; - if (!postfix.isEmpty() && idExists(Texture.getSubId(block, postfix), ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)){ + 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; + } + } + } 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) { + blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); + return id; + } + } + } + + if (idExists(Texture.getSubId(block, postfix), ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)){ id = Texture.getSubId(block, postfix); } else if(idExists(getLogId(block, postfix), ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { @@ -185,13 +217,13 @@ else if(idExists(getLogId(block, "_middle"), ResourceType.CLIENT_RESOURCES, IdLo else if(idExists(getLogId(block, "_bottom"), ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { id = getLogId(block, "_bottom"); } - else { - if (!Registry.BLOCK.getId(block).getNamespace().equals("quark")) { - PaladinFurnitureMod.GENERAL_LOGGER.warn("Couldn't find texture for, {}", block); - } + else if (Registry.BLOCK.getId(block).getNamespace().equals("quark")) { id = Texture.getSubId(block, postfix); + } else { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Couldn't find texture for, {}, this is attempt {} at finding it", block, attemptNum); + id = MissingSprite.getMissingSpriteId(); } - blockToTextureMap.put(pair, id); + blockToTextureMap.put(pair, new Pair<>(id, attemptNum)); return id; } @@ -253,9 +285,12 @@ public static Identifier getLogId(Block block, String postFix) { if (!path.contains("_log")) { path = path.replace("log", "_log"); } + Identifier id = new Identifier(namespace, "block/" + path); + if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { + return id; + } path = path.replace("stem", "log").replace("log", "bark"); path += postFix; - Identifier id = new Identifier(namespace, "block/" + path); if (idExists(id, ResourceType.CLIENT_RESOURCES, IdLocation.TEXTURES)) { return id; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java index 707a795de..adcbeda52 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java @@ -3,10 +3,12 @@ import net.minecraft.util.StringIdentifiable; public enum BlockType implements StringIdentifiable { - PLANKS(null, "planks"), - LOG(null, "log"), + PLANKS( "planks"), + LOG( "log"), + PRIMARY( "primary"), + SECONDARY( "secondary"), STRIPPED_LOG("stripped", "log"), - BLOCK(null, "block"); + BLOCK( "block"); private final String prefix; private final String postfix; @@ -14,6 +16,9 @@ public enum BlockType implements StringIdentifiable { this.postfix = postfix; this.prefix = prefix; } + BlockType(String postfix) { + this(null, postfix); + } public String getPostfix() { return postfix; diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java index 6bdc11625..e8e49f43a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraCounterVariant.java @@ -99,6 +99,8 @@ public Block mainChild() { @Environment(EnvType.CLIENT) @Override public Identifier getTexture(BlockType type) { + if (type == BlockType.SECONDARY) + return ModelHelper.getTextureId(secondaryBlock); return ModelHelper.getTextureId(baseBlock); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java index 620e6f933..4bc8dc9c0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/ExtraStoolVariant.java @@ -99,6 +99,8 @@ public Block mainChild() { @Environment(EnvType.CLIENT) @Override public Identifier getTexture(BlockType type) { + if (type == BlockType.SECONDARY) + return ModelHelper.getTextureId(secondaryBlock); return ModelHelper.getTextureId(baseBlock); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java index 85c1126e9..118426917 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariant.java @@ -111,6 +111,8 @@ public Block mainChild() { @Environment(EnvType.CLIENT) @Override public Identifier getTexture(BlockType type) { + if (type == BlockType.SECONDARY) + return ModelHelper.getTextureId(secondaryBlock); return ModelHelper.getTextureId(baseBlock); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java index 188196cb4..c91364758 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java @@ -33,7 +33,9 @@ protected void finalizeAndFreeze() { if (Objects.equals(entry.getNamespace(), modId)) { if (!linkedHashMap.containsKey(entry.getIdentifier())) { linkedHashMap.put(entry.getIdentifier(), entry); - }else PaladinFurnitureMod.GENERAL_LOGGER.warn("Found block type with duplicate id ({}), skipping",entry.identifier); + }else if (entry != WoodVariantRegistry.OAK) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Found block type with duplicate id ({}), skipping",entry.identifier); + } } }); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java index 78adac3a4..f90e144cd 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java @@ -55,7 +55,7 @@ public String asString() { public Identifier getTexture(BlockType type) { if (type == BlockType.STRIPPED_LOG) { return ModelHelper.getTextureId((Block) this.getChild("stripped_log")); - } else if (type == BlockType.LOG) { + } else if (type == BlockType.LOG || type == BlockType.SECONDARY) { return ModelHelper.getTextureId(this.logBlock); } return ModelHelper.getTextureId(plankBlock); diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java index 2ae652305..cfebd3381 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMAssetGenerator.java @@ -27,6 +27,7 @@ public PFMAssetGenerator(Path output, boolean logOrDebug) { public void run() throws IOException { if (!FROZEN) { + setAssetsRunning(true); log("Packs:"); for (ResourcePack pack : PFMRuntimeResources.RESOURCE_PACK_LIST) { log("\tPack {}", pack.getName()); @@ -34,7 +35,6 @@ public void run() throws IOException { log("\t\tNamespace {}", namespace); } } - this.setRunning(true); FROZEN = true; Path modListPath = output.resolve("modsList"); @@ -90,10 +90,10 @@ public void run() throws IOException { Files.deleteIfExists(modListPath); Files.createFile(modListPath); Files.writeString(PFMRuntimeResources.createDirIfNeeded(modListPath), PaladinFurnitureMod.getVersionMap().toString().replace("[", "").replace("]", ""), StandardOpenOption.APPEND); - this.setRunning(false); } else { log("Data Hash and Mod list matched, skipping generation"); } + setAssetsRunning(false); } } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java index d393fe881..eb5f99eda 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGenerator.java @@ -29,6 +29,7 @@ public PFMDataGenerator(Path output, boolean logOrDebug) { } public void run() throws IOException { if (!FROZEN) { + setDataRunning(true); log("Packs:"); for (ResourcePack pack : PFMRuntimeResources.RESOURCE_PACK_LIST) { log("\tPack {}", pack.getName()); @@ -36,7 +37,6 @@ public void run() throws IOException { log("\t\tNamespace {}", namespace); } } - this.setRunning(true); FROZEN = true; Path modListPath = output.resolve("modsList"); Path hashPath = output.resolve("dataHash"); @@ -98,10 +98,10 @@ public void run() throws IOException { Files.deleteIfExists(modListPath); Files.createFile(modListPath); Files.writeString(PFMRuntimeResources.createDirIfNeeded(modListPath), PaladinFurnitureMod.getVersionMap().toString().replace("[", "").replace("]", ""), StandardOpenOption.APPEND); - setRunning(false); } else { log("Data Hash and Mod list matched, skipping generation"); } + setDataRunning(false); } } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java index a3dec38f7..53e16a0ae 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMGenerator.java @@ -13,7 +13,6 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.*; -import java.util.stream.Collectors; public abstract class PFMGenerator { protected final Path output; @@ -22,7 +21,8 @@ public abstract class PFMGenerator { public static final HashFunction SHA1 = Hashing.sha1(); public static final Gson GSON = new GsonBuilder().setPrettyPrinting().disableHtmlEscaping().create(); - private boolean running = false; + private static boolean assetsRunning = false; + private static boolean dataRunning = false; protected PFMGenerator(Path output, boolean logOrDebug, Logger logger) { this.output = output; @@ -41,12 +41,18 @@ protected void createPackIcon() { } } - public boolean isRunning() { - return running; + public static boolean areAssetsRunning() { + return assetsRunning; } - protected void setRunning(boolean running) { - this.running = running; + public static boolean isDataRunning() { + return dataRunning; + } + protected static void setAssetsRunning(boolean running) { + assetsRunning = running; + } + protected static void setDataRunning(boolean running) { + dataRunning = running; } public Logger getLogger() { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json index 78340a260..0ddd8f41c 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_nightstand/classic_nightstand_middle_open.json @@ -3,7 +3,7 @@ "parent": "block/block", "textures": { "2": "block/stone", - "base": "minecraft:block/oak_plank", + "base": "minecraft:block/oak_planks", "particle": "minecraft:block/oak_log", "support": "minecraft:block/oak_log" }, diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java index a716484fd..bb3cc90f7 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java @@ -10,9 +10,11 @@ import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import net.minecraft.screen.PlayerScreenHandler; +import net.minecraft.util.Identifier; import java.util.List; import java.util.Map; +import java.util.stream.IntStream; public abstract class PFMFabricBakedModel extends AbstractBakedModel implements FabricBakedModel, PFMBakedModelParticleExtension { public PFMFabricBakedModel(ModelBakeSettings settings, List bakedModels) { @@ -36,8 +38,14 @@ public void pushTextureTransform(RenderContext context, Sprite sprite) { public void pushTextureTransform(RenderContext context, List toReplace, List replacement) { context.pushTransform(quad -> { Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)).find(quad, 0); - if (toReplace.stream().anyMatch(sprite -> originalSprite.getId().equals(sprite.getId())) && !toReplace.equals(replacement)) { - Sprite sprite = replacement.get(toReplace.indexOf(originalSprite)); + Identifier keyId = originalSprite.getId(); + int textureIndex = IntStream.range(0, toReplace.size()) + .filter(i -> keyId.equals(toReplace.get(i).getId())) + .findFirst() + .orElse(-1); + + if (textureIndex != -1 && !toReplace.equals(replacement)) { + Sprite sprite = replacement.get(textureIndex); for (int index = 0; index < 4; index++) { float frameU = originalSprite.method_35804(quad.spriteU(index, 0)); float frameV = originalSprite.method_35805(quad.spriteV(index, 0)); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java index fa52f919a..b8a58acc0 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMModResourcePackCreatorMixin.java @@ -3,6 +3,7 @@ import com.google.common.base.Suppliers; import com.mojang.bridge.game.PackType; import com.unlikepaladin.pfm.client.PathPackRPWrapper; +import com.unlikepaladin.pfm.runtime.PFMDataGenerator; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator; import net.minecraft.SharedConstants; @@ -32,13 +33,17 @@ private void addPFMResources(Consumer consumer, ResourcePac PackResourceMetadata packResourceMetadata = new PackResourceMetadata(new LiteralText("Runtime Generated Assets for PFM"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); consumer.accept(factory.create("pfm-asset-resources", new LiteralText("PFM Assets"), true, () -> new PathPackRPWrapper(Suppliers.memoize(() -> { - PFMRuntimeResources.prepareAndRunAssetGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata) + if (!PFMDataGenerator.areAssetsRunning()) + PFMRuntimeResources.prepareAndRunAssetGen(false); + return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata) , packResourceMetadata, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_NONE)); } else if (type == ResourceType.SERVER_DATA) { PackResourceMetadata packResourceMetadata = new PackResourceMetadata(new LiteralText("Runtime Generated Data for PFM"), SharedConstants.getGameVersion().getPackVersion(PackType.DATA)); consumer.accept(factory.create("pfm-data-resources", new LiteralText("PFM Data"), true, () -> new PathPackRPWrapper(Suppliers.memoize(() -> { - PFMRuntimeResources.prepareAndRunDataGen(false); return PFMRuntimeResources.DATA_PACK;}), packResourceMetadata) + if (!PFMDataGenerator.isDataRunning()) + PFMRuntimeResources.prepareAndRunDataGen(false); + return PFMRuntimeResources.DATA_PACK;}), packResourceMetadata) , packResourceMetadata, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_NONE)); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index 5d8bcfe9c..19eceb2d4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -12,6 +12,7 @@ import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import net.minecraft.item.ItemStack; +import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -24,6 +25,7 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.IntStream; public abstract class PFMForgeBakedModel extends AbstractBakedModel implements PFMBakedModelGetQuadsExtension { @Override @@ -65,9 +67,14 @@ public List getQuadsWithTexture(List quads, List t List transformedQuads = new ArrayList<>(quads.size()); for (Map.Entry> entry : separatedQuads.entrySet()) { - if (toReplace.contains(entry.getKey())) { - int i = toReplace.indexOf(entry.getKey()); - Sprite replacement = replacements.get(i); + Identifier keyId = entry.getKey().getId(); + int index = IntStream.range(0, toReplace.size()) + .filter(i -> keyId.equals(toReplace.get(i).getId())) + .findFirst() + .orElse(-1); + + if (index != -1) { + Sprite replacement = replacements.get(index); transformedQuads.addAll(getQuadsWithTexture(entry.getValue().stream().filter(quads::contains).toList(), replacement)); } else { transformedQuads.addAll(entry.getValue().stream().filter(quads::contains).toList()); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java index cc742afa0..6995944cb 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java @@ -7,6 +7,7 @@ import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig; import com.unlikepaladin.pfm.registry.dynamic.forge.LateBlockRegistryForge; import com.unlikepaladin.pfm.registry.forge.*; +import com.unlikepaladin.pfm.runtime.PFMDataGenerator; import net.minecraft.block.Block; import net.minecraft.item.Item; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; @@ -62,13 +63,17 @@ public static void generateResources(AddPackFindersEvent event) { PackResourceMetadata packResourceMetadata = new PackResourceMetadata(new LiteralText("Runtime Generated Assets for PFM"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); event.addRepositorySource((profileAdder, factory) -> profileAdder.accept(factory.create("pfm-asset-resources", new LiteralText("PFM Assets"), true, () -> new PathPackRPWrapper(Suppliers.memoize(() -> { - PFMRuntimeResources.prepareAndRunAssetGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata) + if (!PFMDataGenerator.areAssetsRunning()) + PFMRuntimeResources.prepareAndRunAssetGen(false); + return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata) , packResourceMetadata, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_NONE, false))); } else if (event.getPackType() == ResourceType.SERVER_DATA) { PackResourceMetadata packResourceMetadata = new PackResourceMetadata(new LiteralText("Runtime Generated Data for PFM"), SharedConstants.getGameVersion().getPackVersion(PackType.DATA)); event.addRepositorySource((profileAdder, factory) -> profileAdder.accept(factory.create("pfm-data-resources", new LiteralText("PFM Data"), true, () -> new PathPackRPWrapper(Suppliers.memoize(() -> { - PFMRuntimeResources.prepareAndRunDataGen(false); return PFMRuntimeResources.DATA_PACK;}), packResourceMetadata) + if (!PFMDataGenerator.isDataRunning()) + PFMRuntimeResources.prepareAndRunDataGen(false); + return PFMRuntimeResources.DATA_PACK;}), packResourceMetadata) , packResourceMetadata, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_NONE, false))); } } From d0c9801de70fd7a69c58c79135d9f63ec1d1550a Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Thu, 21 Dec 2023 23:08:58 -0600 Subject: [PATCH 03/10] migrated stools to the new model system --- .../pfm/blocks/models/AbstractBakedModel.java | 8 +- .../pfm/blocks/models/ModelHelper.java | 23 ++- .../models/chair/UnbakedChairModel.java | 74 ++++++++++ .../UnbakedChairClassicModel.java | 74 ++++++++++ .../chairDinner/UnbakedChairDinnerModel.java | 74 ++++++++++ .../chairModern/UnbakedChairModernModel.java | 74 ++++++++++ .../UnbakedClassicStoolModel.java | 73 +++++++++ .../models/logStool/UnbakedLogStoolModel.java | 73 +++++++++ .../modernStool/UnbakedModernStoolModel.java | 76 ++++++++++ .../simpleStool/UnbakedSimpleStoolModel.java | 74 ++++++++++ .../pfm/data/materials/BlockType.java | 2 + .../pfm/data/materials/WoodVariant.java | 4 + .../assets/PFMBlockstateModelProvider.java | 30 ++-- .../chair/{template_chair.json => chair.json} | 6 +- ...te_chair_tucked.json => chair_tucked.json} | 6 +- ..._chair_classic.json => chair_classic.json} | 12 +- ..._tucked.json => chair_classic_tucked.json} | 32 ++-- ...te_chair_dinner.json => chair_dinner.json} | 6 +- ...r_tucked.json => chair_dinner_tucked.json} | 6 +- ...te_chair_modern.json => chair_modern.json} | 6 +- ...n_tucked.json => chair_modern_tucked.json} | 6 +- .../block/classic_stool/classic_stool.json | 125 +++++++--------- .../classic_stool/classic_stool_tucked.json | 139 ++++++++---------- .../pfm/models/block/log_stool/log_stool.json | 63 ++++---- .../block/log_stool/log_stool_tucked.json | 67 +++++---- .../block/modern_stool/modern_stool.json | 63 ++++---- .../modern_stool/modern_stool_tucked.json | 65 ++++---- .../block/simple_stool/simple_stool.json | 6 +- .../simple_stool/simple_stool_tucked.json | 70 +++++---- .../models/chair/fabric/FabricChairModel.java | 53 +++++++ .../chair/fabric/UnbakedChairModelImpl.java | 20 +++ .../fabric/FabricChairClassicModel.java | 53 +++++++ .../fabric/UnbakedChairClassicModelImpl.java | 19 +++ .../fabric/FabricChairDinnerModel.java | 53 +++++++ .../fabric/UnbakedChairDinnerModelImpl.java | 19 +++ .../fabric/FabricChairModernModel.java | 53 +++++++ .../fabric/UnbakedChairModernModelImpl.java | 20 +++ .../fabric/FabricClassicNightstandModel.java | 6 +- .../fabric/FabricClassicStoolModel.java | 53 +++++++ .../fabric/UnbakedClassicStoolModelImpl.java | 19 +++ .../logStool/fabric/FabricLogStoolModel.java | 54 +++++++ .../fabric/UnbakedLogStoolModelImpl.java | 19 +++ .../fabric/FabricModernStoolModel.java | 53 +++++++ .../fabric/UnbakedModernStoolModelImpl.java | 19 +++ .../fabric/FabricSimpleStoolModel.java | 53 +++++++ .../fabric/UnbakedSimpleStoolModelImpl.java | 19 +++ .../client/fabric/PFMExtraModelProvider.java | 33 ++++- .../pfm/client/fabric/PFMModelProvider.java | 32 ++++ .../models/chair/forge/ForgeChairModel.java | 70 +++++++++ .../chair/forge/UnbakedChairModelImpl.java | 19 +++ .../forge/ForgeChairClassicModel.java | 70 +++++++++ .../forge/UnbakedChairClassicModelImpl.java | 19 +++ .../forge/ForgeChairDinnerModel.java | 70 +++++++++ .../forge/UnbakedChairDinnerModelImpl.java | 19 +++ .../forge/ForgeChairModernModel.java | 70 +++++++++ .../forge/UnbakedChairModernModelImpl.java | 20 +++ .../forge/ForgeClassicNightstandModel.java | 7 +- .../forge/ForgeClassicStoolModel.java | 70 +++++++++ .../forge/UnbakedClassicStoolModelImpl.java | 19 +++ .../logStool/forge/ForgeLogStoolModel.java | 70 +++++++++ .../forge/UnbakedLogStoolModelImpl.java | 19 +++ .../forge/ForgeModernStoolModel.java | 70 +++++++++ .../forge/UnbakedModernStoolModelImpl.java | 19 +++ .../forge/ForgeSimpleStoolModel.java | 70 +++++++++ .../forge/UnbakedSimpleStoolModelImpl.java | 19 +++ .../forge/PaladinFurnitureModClientForge.java | 32 ++++ .../pfm/mixin/forge/PFMModelLoaderMixin.java | 56 +++++++ 67 files changed, 2407 insertions(+), 388 deletions(-) create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java rename common/src/main/resources/assets/pfm/models/block/chair/{template_chair.json => chair.json} (97%) rename common/src/main/resources/assets/pfm/models/block/chair/{template_chair_tucked.json => chair_tucked.json} (97%) rename common/src/main/resources/assets/pfm/models/block/chair_classic/{template_chair_classic.json => chair_classic.json} (97%) rename common/src/main/resources/assets/pfm/models/block/chair_classic/{template_chair_classic_tucked.json => chair_classic_tucked.json} (90%) rename common/src/main/resources/assets/pfm/models/block/chair_dinner/{template_chair_dinner.json => chair_dinner.json} (98%) rename common/src/main/resources/assets/pfm/models/block/chair_dinner/{template_chair_dinner_tucked.json => chair_dinner_tucked.json} (98%) rename common/src/main/resources/assets/pfm/models/block/chair_modern/{template_chair_modern.json => chair_modern.json} (97%) rename common/src/main/resources/assets/pfm/models/block/chair_modern/{template_chair_modern_tucked.json => chair_modern_tucked.json} (97%) create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/FabricChairModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/FabricChairClassicModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/FabricChairDinnerModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/FabricChairModernModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/FabricClassicStoolModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/FabricLogStoolModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/FabricModernStoolModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/FabricSimpleStoolModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/ForgeChairModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/ForgeChairClassicModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/ForgeChairDinnerModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/ForgeChairModernModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/ForgeClassicStoolModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/ForgeLogStoolModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/ForgeModernStoolModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/ForgeSimpleStoolModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 2e249f800..236f4b6f4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -1,6 +1,7 @@ package com.unlikepaladin.pfm.blocks.models; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.LogStoolBlock; import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; @@ -129,7 +130,12 @@ private List getSpriteFromState(BlockState state) { VariantBase variant = getVariant(state); boolean stripped = state.getBlock().getTranslationKey().contains("stripped"); List list = new ArrayList<>(3); - if (!state.getBlock().getTranslationKey().contains("_raw_")) { + if (state.getBlock() instanceof LogStoolBlock) { + SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.LOG)); + SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG_TOP)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.LOG_TOP)); + list.add(mainTexture.getSprite()); + list.add(secondTexture.getSprite()); + } else if (!state.getBlock().getTranslationKey().contains("_raw_")) { SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PRIMARY)); SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PRIMARY)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.SECONDARY)); list.add(mainTexture.getSprite()); 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 78eda9b14..23ea2001b 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 @@ -12,7 +12,6 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.texture.MissingSprite; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.data.client.model.Texture; import net.minecraft.resource.ResourcePack; @@ -29,15 +28,25 @@ import java.util.concurrent.atomic.AtomicBoolean; public class ModelHelper { - private static final List OAK_SPRITES_TO_REPLACE = new ArrayList<>(); - public static List getOakSprites() { - if (OAK_SPRITES_TO_REPLACE.isEmpty()) { + private static final List OAK_SPRITES_PLANKS_TO_REPLACE = new ArrayList<>(); + public static List getOakPlankLogSprites() { + if (OAK_SPRITES_PLANKS_TO_REPLACE.isEmpty()) { SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.PLANKS)); SpriteIdentifier logId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.LOG)); - OAK_SPRITES_TO_REPLACE.add(planksId.getSprite()); - OAK_SPRITES_TO_REPLACE.add(logId.getSprite()); + OAK_SPRITES_PLANKS_TO_REPLACE.add(planksId.getSprite()); + OAK_SPRITES_PLANKS_TO_REPLACE.add(logId.getSprite()); } - return OAK_SPRITES_TO_REPLACE; + return OAK_SPRITES_PLANKS_TO_REPLACE; + } + private static final List OAK_SPRITES_LOG_TOP_TO_REPLACE = new ArrayList<>(); + public static List getOakLogLogTopSprites() { + if (OAK_SPRITES_LOG_TOP_TO_REPLACE.isEmpty()) { + SpriteIdentifier logId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.LOG)); + SpriteIdentifier logTopId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.LOG_TOP)); + OAK_SPRITES_LOG_TOP_TO_REPLACE.add(logId.getSprite()); + OAK_SPRITES_LOG_TOP_TO_REPLACE.add(logTopId.getSprite()); + } + return OAK_SPRITES_LOG_TOP_TO_REPLACE; } public static boolean containsIdentifier(Identifier[] modelIds, Identifier comparison) { AtomicBoolean contains = new AtomicBoolean(false); diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java new file mode 100644 index 000000000..f772810f9 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/UnbakedChairModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.chair; + +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 UnbakedChairModel implements UnbakedModel { + public static final Identifier[] CHAIR_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair/chair"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair/chair_tucked") + }; + + public static final Identifier CHAIR_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair"); + public static final List CHAIR_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair")); + } + add(CHAIR_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 : CHAIR_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/blocks/models/chairClassic/UnbakedChairClassicModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java new file mode 100644 index 000000000..cb8a2b17f --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/UnbakedChairClassicModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.chairClassic; + +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 UnbakedChairClassicModel implements UnbakedModel { + public static final Identifier[] CHAIR_CLASSIC_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_classic/chair_classic"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_classic/chair_classic_tucked") + }; + + public static final Identifier CHAIR_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_classic"); + public static final List CHAIR_CLASSIC_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_classic")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_classic")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_classic")); + } + add(CHAIR_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 : CHAIR_CLASSIC_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/blocks/models/chairDinner/UnbakedChairDinnerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java new file mode 100644 index 000000000..cca714948 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/UnbakedChairDinnerModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.chairDinner; + +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 UnbakedChairDinnerModel implements UnbakedModel { + public static final Identifier[] CHAIR_DINNER_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_dinner/chair_dinner"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_dinner/chair_dinner_tucked") + }; + + public static final Identifier CHAIR_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_dinner"); + public static final List CHAIR_DINNER_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_dinner")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_dinner")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_dinner")); + } + add(CHAIR_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 : CHAIR_DINNER_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/blocks/models/chairModern/UnbakedChairModernModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java new file mode 100644 index 000000000..14ac2f47f --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/UnbakedChairModernModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.chairModern; + +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 UnbakedChairModernModel implements UnbakedModel { + public static final Identifier[] CHAIR_MODERN_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_modern/chair_modern"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_modern/chair_modern_tucked") + }; + + public static final Identifier CHAIR_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/chair_modern"); + public static final List CHAIR_MODERN_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_modern")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_chair_modern")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_chair_modern")); + } + add(CHAIR_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 : CHAIR_MODERN_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/blocks/models/classicStool/UnbakedClassicStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java new file mode 100644 index 000000000..97518d9c2 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/UnbakedClassicStoolModel.java @@ -0,0 +1,73 @@ +package com.unlikepaladin.pfm.blocks.models.classicStool; + +import com.mojang.datafixers.util.Pair; +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.ExtraStoolVariant; +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 UnbakedClassicStoolModel implements UnbakedModel { + public static final Identifier[] CLASSIC_STOOL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_stool/classic_stool"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_stool/classic_stool_tucked") + }; + + public static final Identifier STOOL_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_stool"); + public static final List CLASSIC_STOOL_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_stool")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_classic_stool")); + } + for(StoneVariant variant : StoneVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_classic_stool")); + } + add(STOOL_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 : CLASSIC_STOOL_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/blocks/models/logStool/UnbakedLogStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java new file mode 100644 index 000000000..389650014 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/UnbakedLogStoolModel.java @@ -0,0 +1,73 @@ +package com.unlikepaladin.pfm.blocks.models.logStool; + +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 UnbakedLogStoolModel implements UnbakedModel { + public static final Identifier[] LOG_STOOL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_stool/log_stool"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_stool/log_stool_tucked") + }; + + public static final Identifier STOOL_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/log_stool"); + public static final List LOG_STOOL_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + String logType = variant.isNetherWood() ? "stem" : "log"; + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_" + logType + "_stool")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_" + logType + "_stool")); + } + for(StoneVariant variant : StoneVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_log_stool")); + } + add(STOOL_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 : LOG_STOOL_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/blocks/models/modernStool/UnbakedModernStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java new file mode 100644 index 000000000..d8ee10e04 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/UnbakedModernStoolModel.java @@ -0,0 +1,76 @@ +package com.unlikepaladin.pfm.blocks.models.modernStool; + +import com.mojang.datafixers.util.Pair; +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.ExtraStoolVariant; +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 UnbakedModernStoolModel implements UnbakedModel { + public static final Identifier[] MODERN_STOOL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/modern_stool/modern_stool"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/modern_stool/modern_stool_tucked") + }; + + public static final Identifier STOOL_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/modern_stool"); + public static final List MODERN_STOOL_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_modern_stool")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_modern_stool")); + } + for(StoneVariant variant : StoneVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_modern_stool")); + } + for(ExtraStoolVariant variant : ExtraStoolVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_modern_stool")); + } + add(STOOL_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 : MODERN_STOOL_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/blocks/models/simpleStool/UnbakedSimpleStoolModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java new file mode 100644 index 000000000..da390cf5d --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/UnbakedSimpleStoolModel.java @@ -0,0 +1,74 @@ +package com.unlikepaladin.pfm.blocks.models.simpleStool; + +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 UnbakedSimpleStoolModel implements UnbakedModel { + public static final Identifier[] SIMPLE_STOOL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_stool/simple_stool"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_stool/simple_stool_tucked") + }; + + public static final Identifier STOOL_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_stool"); + public static final List SIMPLE_STOOL_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_stool")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_simple_stool")); + } + for(StoneVariant variant : StoneVariant.values()){ + + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_simple_stool")); + } + add(STOOL_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 : SIMPLE_STOOL_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/data/materials/BlockType.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java index adcbeda52..bc0d12efe 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/BlockType.java @@ -5,9 +5,11 @@ public enum BlockType implements StringIdentifiable { PLANKS( "planks"), LOG( "log"), + LOG_TOP( "log_top"), PRIMARY( "primary"), SECONDARY( "secondary"), STRIPPED_LOG("stripped", "log"), + STRIPPED_LOG_TOP("stripped", "log_top"), BLOCK( "block"); private final String prefix; diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java index f90e144cd..b44132a2b 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/WoodVariant.java @@ -57,6 +57,10 @@ public Identifier getTexture(BlockType type) { return ModelHelper.getTextureId((Block) this.getChild("stripped_log")); } else if (type == BlockType.LOG || type == BlockType.SECONDARY) { return ModelHelper.getTextureId(this.logBlock); + } else if (type == BlockType.LOG_TOP) { + return ModelHelper.getTextureId(this.logBlock, "_top"); + } else if (type == BlockType.STRIPPED_LOG_TOP) { + return ModelHelper.getTextureId((Block) this.getChild("stripped_log"), "_top"); } return ModelHelper.getTextureId(plankBlock); } 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 440661f67..5578b5b89 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 @@ -130,28 +130,28 @@ public void registerModelsAndStates() { } public void registerTuckableChairs() { - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMap(), "chair", TEMPLATE_CHAIR, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMapNonBase(), "chair", TEMPLATE_CHAIR, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMap(), "chair", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMapNonBase(), "chair", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerChairBlock.class).getVariantToBlockMap(), "chair_dinner", TEMPLATE_CHAIR_DINNER, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerChairBlock.class).getVariantToBlockMapNonBase(), "chair_dinner", TEMPLATE_CHAIR_DINNER, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerChairBlock.class).getVariantToBlockMap(), "chair_dinner", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(DinnerChairBlock.class).getVariantToBlockMapNonBase(), "chair_dinner", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicChairBlock.class).getVariantToBlockMap(), "chair_classic", TEMPLATE_CHAIR_CLASSIC, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicChairBlock.class).getVariantToBlockMapNonBase(), "chair_classic", TEMPLATE_CHAIR_CLASSIC, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernChairBlock.class).getVariantToBlockMap(), "chair_modern", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernChairBlock.class).getVariantToBlockMapNonBase(), "chair_modern", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernChairBlock.class).getVariantToBlockMap(), "chair_modern", TEMPLATE_CHAIR_MODERN, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernChairBlock.class).getVariantToBlockMapNonBase(), "chair_modern", TEMPLATE_CHAIR_MODERN, PFMBlockStateModelGenerator::createOrientableTuckableBlockState, PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicChairBlock.class).getVariantToBlockMap(), "chair_classic", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicChairBlock.class).getVariantToBlockMapNonBase(), "chair_classic", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogStoolBlock.class).getVariantToBlockMap(), "log_stool", TEMPLATE_LOG_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createLogLogTopBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(LogStoolBlock.class).getVariantToBlockMap(), "log_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleStoolBlock.class).getVariantToBlockMap(), "simple_stool", TEMPLATE_SIMPLE_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleStoolBlock.class).getVariantToBlockMapNonBase(), "simple_stool", TEMPLATE_SIMPLE_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleStoolBlock.class).getVariantToBlockMap(), "simple_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleStoolBlock.class).getVariantToBlockMapNonBase(), "simple_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicStoolBlock.class).getVariantToBlockMap(), "classic_stool", TEMPLATE_CLASSIC_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicStoolBlock.class).getVariantToBlockMapNonBase(), "classic_stool", TEMPLATE_CLASSIC_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicStoolBlock.class).getVariantToBlockMap(), "classic_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicStoolBlock.class).getVariantToBlockMapNonBase(), "classic_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernStoolBlock.class).getVariantToBlockMap(), "modern_stool", TEMPLATE_MODERN_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernStoolBlock.class).getVariantToBlockMapNonBase(), "modern_stool", TEMPLATE_MODERN_STOOL, (block, identifiers) -> createOrientableTuckableBlockState(block, identifiers, 90), PFMBlockStateModelGenerator::createPlankLogBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernStoolBlock.class).getVariantToBlockMap(), "modern_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ModernStoolBlock.class).getVariantToBlockMapNonBase(), "modern_stool", (block, identifiers) -> createOrientableTableBlockState(block, identifiers, 90)); } public void registerTables() { diff --git a/common/src/main/resources/assets/pfm/models/block/chair/template_chair.json b/common/src/main/resources/assets/pfm/models/block/chair/chair.json similarity index 97% rename from common/src/main/resources/assets/pfm/models/block/chair/template_chair.json rename to common/src/main/resources/assets/pfm/models/block/chair/chair.json index 17504c498..1847d6215 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair/template_chair.json +++ b/common/src/main/resources/assets/pfm/models/block/chair/chair.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/chair/template_chair_tucked.json b/common/src/main/resources/assets/pfm/models/block/chair/chair_tucked.json similarity index 97% rename from common/src/main/resources/assets/pfm/models/block/chair/template_chair_tucked.json rename to common/src/main/resources/assets/pfm/models/block/chair/chair_tucked.json index 0b3c5e584..0e63804a9 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair/template_chair_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/chair/chair_tucked.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic.json b/common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic.json similarity index 97% rename from common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic.json rename to common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic.json index 134f7fdea..d179ec212 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { @@ -15,8 +15,7 @@ "east": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "west": {"uv": [1, 0, 3, 15], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { @@ -28,8 +27,7 @@ "east": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 15], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { diff --git a/common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic_tucked.json b/common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic_tucked.json similarity index 90% rename from common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic_tucked.json rename to common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic_tucked.json index 5f739ce24..e97dcdd01 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_classic/template_chair_classic_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_classic/chair_classic_tucked.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "parent": "block/block", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { @@ -16,8 +16,7 @@ "east": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "west": {"uv": [1, 0, 3, 15], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { @@ -29,8 +28,7 @@ "east": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 15], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 15], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"}, - "down": {"uv": [0, 0, 2, 2], "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { @@ -112,7 +110,7 @@ "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [1, 9, 12.1, 10], "rotation": 180, "texture": "#base"}, - "east": {"uv": [5, 1.5, 6.5, 13.47219], "rotation": 90, "texture": "#base"}, + "east": {"uv": [5, 1.5, 6.5, 13.47219], "rotation": 90, "texture": "#base", "cullface": "east"}, "south": {"uv": [1, 1, 12.1, 2], "rotation": 180, "texture": "#base"}, "west": {"uv": [5, 1.5, 6.5, 13.47219], "rotation": 90, "texture": "#base"}, "up": {"uv": [0, 1.5, 11.1, 13.47219], "texture": "#base"} @@ -125,7 +123,7 @@ "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [2, 11, 13.2, 12.1], "rotation": 180, "texture": "#legs"}, - "east": {"uv": [0, 4, 12, 5], "texture": "#legs"}, + "east": {"uv": [0, 4, 12, 5], "texture": "#legs", "cullface": "east"}, "south": {"uv": [2, 14, 13, 15], "texture": "#legs"}, "west": {"uv": [4, 2, 5.4, 14], "rotation": 90, "texture": "#legs"}, "up": {"uv": [0, 1, 11.2, 13], "texture": "#legs"}, @@ -149,10 +147,10 @@ "to": [22, 9, 13.9], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "east": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "south": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "west": {"uv": [1, 1, 3, 10], "texture": "#legs"}, + "north": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, "down": {"uv": [12, 8, 14, 10], "texture": "#legs", "cullface": "down"} } }, @@ -173,10 +171,10 @@ "to": [22, 9, 4.05], "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "east": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "south": {"uv": [1, 1, 3, 10], "texture": "#legs"}, - "west": {"uv": [1, 1, 3, 10], "texture": "#legs"}, + "north": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [1, 1, 3, 10], "texture": "#legs", "cullface": "east"}, "down": {"uv": [8, 11, 10, 13], "texture": "#legs", "cullface": "down"} } } diff --git a/common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner.json b/common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner.json similarity index 98% rename from common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner.json rename to common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner.json index a10a9fc3a..e7694d3e2 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner_tucked.json b/common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner_tucked.json similarity index 98% rename from common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner_tucked.json rename to common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner_tucked.json index 3bbb490bc..4eba2ee9f 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_dinner/template_chair_dinner_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_dinner/chair_dinner_tucked.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern.json b/common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern.json similarity index 97% rename from common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern.json rename to common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern.json index 7a626e957..fe5c1e05d 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern_tucked.json b/common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern_tucked.json similarity index 97% rename from common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern_tucked.json rename to common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern_tucked.json index 9950e63b2..d436364f4 100644 --- a/common/src/main/resources/assets/pfm/models/block/chair_modern/template_chair_modern_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/chair_modern/chair_modern_tucked.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool.json b/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool.json index e97354b9a..0638faf02 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool.json @@ -1,139 +1,124 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { - "from": [3.625, 0, 3.5], - "to": [5.625, 10, 5.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [10.5, 0, 3.625], + "to": [12.5, 10, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.625, 0, 3.5], - "to": [12.625, 10, 5.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [10.5, 0, 10.625], + "to": [12.5, 10, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.625, 0, 10.5], - "to": [12.625, 10, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [3.5, 0, 10.625], + "to": [5.5, 10, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [3.625, 10, 3.5], - "to": [12.625, 11, 10.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [5.5, 10, 3.625], + "to": [12.5, 11, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 1, 9, 2], "texture": "#base"}, - "east": {"uv": [0, 1, 7, 2], "texture": "#base"}, - "south": {"uv": [0, 1, 9, 2], "texture": "#base"}, - "west": {"uv": [0, 1, 7, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 10, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 10, 8], "texture": "#base"} + "north": {"uv": [0, 1, 7, 2], "texture": "#base"}, + "east": {"uv": [0, 1, 9, 2], "texture": "#base"}, + "south": {"uv": [0, 1, 7, 2], "texture": "#base"}, + "down": {"uv": [1, 1, 10, 8], "rotation": 270, "texture": "#base"} } }, { - "from": [3.625, 11, 3.5], - "to": [12.625, 12, 10.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [5.5, 11, 3.625], + "to": [12.5, 12, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 9, 1], "texture": "#base"}, - "east": {"uv": [0, 0, 7, 1], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 1], "texture": "#base"}, - "west": {"uv": [0, 0, 7, 1], "texture": "#base"}, - "up": {"uv": [1, 1, 10, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 10, 8], "texture": "#base"} + "north": {"uv": [0, 0, 7, 1], "texture": "#base"}, + "east": {"uv": [0, 0, 9, 1], "texture": "#base"}, + "south": {"uv": [0, 0, 7, 1], "texture": "#base"}, + "up": {"uv": [1, 1, 10, 8], "rotation": 90, "texture": "#base"} } }, { - "from": [5.625, 10, 10.5], - "to": [10.625, 12, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [3.5, 10, 5.625], + "to": [5.5, 12, 10.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 2], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 2], "texture": "#base"}, - "south": {"uv": [0, 0, 5, 2], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 2], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 3], "texture": "#base"}, - "down": {"uv": [4, 2, 9, 4], "texture": "#base"} + "west": {"uv": [0, 0, 5, 2], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 3], "rotation": 90, "texture": "#base"}, + "down": {"uv": [4, 2, 9, 4], "rotation": 270, "texture": "#base"} } }, { - "from": [5.625, 15, 11], - "to": [10.625, 19.5, 12], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [4, 15, 5.625], + "to": [5, 19.5, 10.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 1, 6, 6], "texture": "#base"}, - "east": {"uv": [0, 0, 1, 5], "texture": "#base"}, - "south": {"uv": [1, 1, 6, 6], "texture": "#base"}, - "west": {"uv": [0, 0, 1, 5], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 2], "texture": "#base"}, - "down": {"uv": [4, 2, 9, 3], "texture": "#base"} + "east": {"uv": [1, 1, 6, 6], "texture": "#base"}, + "west": {"uv": [1, 1, 6, 6], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 2], "rotation": 90, "texture": "#base", "cullface": "up"}, + "down": {"uv": [4, 2, 9, 3], "rotation": 270, "texture": "#base"} } }, { - "from": [3.625, 0, 10.5], - "to": [5.625, 10, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [3.5, 0, 3.625], + "to": [5.5, 10, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [3.625, 10, 10.5], - "to": [5.625, 20, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [3.5, 10, 3.625], + "to": [5.5, 20, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { - "from": [10.625, 10, 10.5], - "to": [12.625, 20, 12.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [3.5, 10, 10.625], + "to": [5.5, 20, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } } ], @@ -161,7 +146,7 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [30, -135, 0], + "rotation": [30, -45, 0], "translation": [0.5, -1, 0], "scale": [0.59, 0.59, 0.59] }, diff --git a/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool_tucked.json b/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool_tucked.json index b4e123cb1..ae04296dd 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_stool/classic_stool_tucked.json @@ -1,139 +1,124 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { - "from": [3.625, 0, -4.5], - "to": [5.625, 10, -2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [18.5, 0, 3.625], + "to": [20.5, 10, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "north": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.625, 0, -4.5], - "to": [12.625, 10, -2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [18.5, 0, 10.625], + "to": [20.5, 10, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "north": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.625, 0, 2.5], - "to": [12.625, 10, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 0, 10.625], + "to": [13.5, 10, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [3.625, 10, -4.5], - "to": [12.625, 11, 2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [13.5, 10, 3.625], + "to": [20.5, 11, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 1, 9, 2], "texture": "#base"}, - "east": {"uv": [0, 1, 7, 2], "texture": "#base"}, - "south": {"uv": [0, 1, 9, 2], "texture": "#base"}, - "west": {"uv": [0, 1, 7, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 10, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 10, 8], "texture": "#base"} + "north": {"uv": [0, 1, 7, 2], "texture": "#base"}, + "east": {"uv": [0, 1, 9, 2], "texture": "#base", "cullface": "east"}, + "south": {"uv": [0, 1, 7, 2], "texture": "#base"}, + "down": {"uv": [1, 1, 10, 8], "rotation": 270, "texture": "#base"} } }, { - "from": [3.625, 11, -4.5], - "to": [12.625, 12, 2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [13.5, 11, 3.625], + "to": [20.5, 12, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 9, 1], "texture": "#base"}, - "east": {"uv": [0, 0, 7, 1], "texture": "#base"}, - "south": {"uv": [0, 0, 9, 1], "texture": "#base"}, - "west": {"uv": [0, 0, 7, 1], "texture": "#base"}, - "up": {"uv": [1, 1, 10, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 10, 8], "texture": "#base"} + "north": {"uv": [0, 0, 7, 1], "texture": "#base"}, + "east": {"uv": [0, 0, 9, 1], "texture": "#base", "cullface": "east"}, + "south": {"uv": [0, 0, 7, 1], "texture": "#base"}, + "up": {"uv": [1, 1, 10, 8], "rotation": 90, "texture": "#base"} } }, { - "from": [5.625, 10, 2.5], - "to": [10.625, 12, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 10, 5.625], + "to": [13.5, 12, 10.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 2], "texture": "#base"}, - "east": {"uv": [0, 0, 2, 2], "texture": "#base"}, - "south": {"uv": [0, 0, 5, 2], "texture": "#base"}, - "west": {"uv": [0, 0, 2, 2], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 3], "texture": "#base"}, - "down": {"uv": [4, 2, 9, 4], "texture": "#base"} + "west": {"uv": [0, 0, 5, 2], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 3], "rotation": 90, "texture": "#base"}, + "down": {"uv": [4, 2, 9, 4], "rotation": 270, "texture": "#base"} } }, { - "from": [5.625, 15, 3], - "to": [10.625, 19.5, 4], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [12, 15, 5.625], + "to": [13, 19.5, 10.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 1, 6, 6], "texture": "#base"}, - "east": {"uv": [0, 0, 1, 5], "texture": "#base"}, - "south": {"uv": [1, 1, 6, 6], "texture": "#base"}, - "west": {"uv": [0, 0, 1, 5], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 2], "texture": "#base"}, - "down": {"uv": [4, 2, 9, 3], "texture": "#base"} + "east": {"uv": [1, 1, 6, 6], "texture": "#base"}, + "west": {"uv": [1, 1, 6, 6], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 2], "rotation": 90, "texture": "#base", "cullface": "up"}, + "down": {"uv": [4, 2, 9, 3], "rotation": 270, "texture": "#base"} } }, { - "from": [3.625, 0, 2.5], - "to": [5.625, 10, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 0, 3.625], + "to": [13.5, 10, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [3.625, 10, 2.5], - "to": [5.625, 20, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 10, 3.625], + "to": [13.5, 20, 5.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } }, { - "from": [10.625, 10, 2.5], - "to": [12.625, 20, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 10, 10.625], + "to": [13.5, 20, 12.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "up"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool.json b/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool.json index 3b508b531..b58662a36 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool.json +++ b/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool.json @@ -1,57 +1,62 @@ { "credit": "By UnlikePaladin", "textures": { - "top": "#log_top", - "particle": "#log", - "side": "#log" + "top": "block/oak_log_top", + "particle": "block/oak_log", + "side": "block/oak_log" }, "elements": [ - { - "from": [8, 0, 8], - "to": [13, 11, 13], - "faces": { - "east": {"uv": [2, 4, 7, 15], "texture": "#side"}, - "south": {"uv": [3, 3, 8, 14], "texture": "#side"}, - "up": {"uv": [11, 11, 16, 16], "texture": "#top"}, - "down": {"uv": [11, 0, 16, 5], "texture": "#top", "cullface": "down"} - } - }, { "from": [3, 0, 8], "to": [8, 11, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "south": {"uv": [3, 3, 8, 14], "texture": "#side"}, - "west": {"uv": [2, 1, 7, 12], "texture": "#side"}, - "up": {"uv": [0, 11, 5, 16], "texture": "#top"}, - "down": {"uv": [0, 0, 5, 5], "texture": "#top", "cullface": "down"} + "south": {"uv": [2, 4, 7, 15], "texture": "#side"}, + "west": {"uv": [3, 3, 8, 14], "texture": "#side"}, + "up": {"uv": [11, 11, 16, 16], "rotation": 90, "texture": "#top"}, + "down": {"uv": [11, 0, 16, 5], "rotation": 270, "texture": "#top", "cullface": "down"} } }, { "from": [3, 0, 3], "to": [8, 11, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, + "faces": { + "north": {"uv": [2, 1, 7, 12], "texture": "#side"}, + "west": {"uv": [3, 3, 8, 14], "texture": "#side"}, + "up": {"uv": [0, 11, 5, 16], "rotation": 90, "texture": "#top"}, + "down": {"uv": [0, 0, 5, 5], "rotation": 270, "texture": "#top", "cullface": "down"} + } + }, + { + "from": [8, 0, 3], + "to": [13, 11, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 11], "texture": "#side"}, - "west": {"uv": [2, 1, 7, 12], "texture": "#side"}, - "up": {"uv": [0, 0, 5, 5], "texture": "#top"}, - "down": {"uv": [0, 11, 5, 16], "texture": "#top", "cullface": "down"} + "north": {"uv": [2, 1, 7, 12], "texture": "#side"}, + "east": {"uv": [0, 0, 5, 11], "texture": "#side"}, + "up": {"uv": [0, 0, 5, 5], "rotation": 90, "texture": "#top"}, + "down": {"uv": [0, 11, 5, 16], "rotation": 270, "texture": "#top", "cullface": "down"} } }, { "from": [7, -0.001, 7], "to": [9, 11.001, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "up": {"uv": [7, 7, 9, 9], "texture": "#top"}, - "down": {"uv": [7, 7, 9, 9], "texture": "#top", "cullface": "down"} + "up": {"uv": [7, 7, 9, 9], "rotation": 90, "texture": "#top"}, + "down": {"uv": [7, 7, 9, 9], "rotation": 270, "texture": "#top", "cullface": "down"} } }, { - "from": [8, 0, 3], - "to": [13, 11, 8], + "from": [8, 0, 8], + "to": [13, 11, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 11], "texture": "#side"}, - "east": {"uv": [2, 4, 7, 15], "texture": "#side"}, - "up": {"uv": [11, 0, 16, 5], "texture": "#top"}, - "down": {"uv": [11, 11, 16, 16], "texture": "#top", "cullface": "down"} + "east": {"uv": [0, 0, 5, 11], "texture": "#side"}, + "south": {"uv": [2, 4, 7, 15], "texture": "#side"}, + "up": {"uv": [11, 0, 16, 5], "rotation": 90, "texture": "#top"}, + "down": {"uv": [11, 11, 16, 16], "rotation": 270, "texture": "#top", "cullface": "down"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool_tucked.json b/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool_tucked.json index 79e7f0852..e8464c4ff 100644 --- a/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/log_stool/log_stool_tucked.json @@ -1,57 +1,62 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#log_top", - "1": "#log", - "particle": "#log" + "0": "block/oak_log_top", + "1": "block/oak_log", + "particle": "block/oak_log" }, "elements": [ { - "from": [8, 0, 0], - "to": [13, 11, 5], + "from": [11, 0, 8], + "to": [16, 11, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "east": {"uv": [2, 4, 7, 15], "texture": "#1"}, - "south": {"uv": [3, 3, 8, 14], "texture": "#1"}, - "up": {"uv": [11, 11, 16, 16], "texture": "#0"}, - "down": {"uv": [11, 0, 16, 5], "texture": "#0", "cullface": "down"} + "south": {"uv": [2, 4, 7, 15], "texture": "#1"}, + "west": {"uv": [3, 3, 8, 14], "texture": "#1"}, + "up": {"uv": [11, 11, 16, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [11, 0, 16, 5], "rotation": 270, "texture": "#0", "cullface": "down"} } }, { - "from": [3, 0, 0], - "to": [8, 11, 5], + "from": [11, 0, 3], + "to": [16, 11, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "south": {"uv": [3, 3, 8, 14], "texture": "#1"}, - "west": {"uv": [2, 1, 7, 12], "texture": "#1"}, - "up": {"uv": [0, 11, 5, 16], "texture": "#0"}, - "down": {"uv": [0, 0, 5, 5], "texture": "#0", "cullface": "down"} + "north": {"uv": [2, 1, 7, 12], "texture": "#1"}, + "west": {"uv": [3, 3, 8, 14], "texture": "#1"}, + "up": {"uv": [0, 11, 5, 16], "rotation": 90, "texture": "#0"}, + "down": {"uv": [0, 0, 5, 5], "rotation": 270, "texture": "#0", "cullface": "down"} } }, { - "from": [3, 0, -5], - "to": [8, 11, 0], + "from": [16, 0, 3], + "to": [21, 11, 8], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 11], "texture": "#1"}, - "west": {"uv": [2, 1, 7, 12], "texture": "#1"}, - "up": {"uv": [0, 0, 5, 5], "texture": "#0"}, - "down": {"uv": [0, 11, 5, 16], "texture": "#0", "cullface": "down"} + "north": {"uv": [2, 1, 7, 12], "texture": "#1", "cullface": "east"}, + "east": {"uv": [0, 0, 5, 11], "texture": "#1", "cullface": "east"}, + "up": {"uv": [0, 0, 5, 5], "rotation": 90, "texture": "#0", "cullface": "east"}, + "down": {"uv": [0, 11, 5, 16], "rotation": 270, "texture": "#0", "cullface": "down"} } }, { - "from": [8, 0, -5], - "to": [13, 11, 0], + "from": [16, 0, 8], + "to": [21, 11, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 5, 11], "texture": "#1"}, - "east": {"uv": [2, 4, 7, 15], "texture": "#1"}, - "up": {"uv": [11, 0, 16, 5], "texture": "#0"}, - "down": {"uv": [11, 11, 16, 16], "texture": "#0", "cullface": "down"} + "east": {"uv": [0, 0, 5, 11], "texture": "#1", "cullface": "east"}, + "south": {"uv": [2, 4, 7, 15], "texture": "#1", "cullface": "east"}, + "up": {"uv": [11, 0, 16, 5], "rotation": 90, "texture": "#0", "cullface": "east"}, + "down": {"uv": [11, 11, 16, 16], "rotation": 270, "texture": "#0", "cullface": "down"} } }, { - "from": [7, -0.001, -1], - "to": [9, 11.001, 1], + "from": [15, -0.001, 7], + "to": [17, 11.001, 9], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "up": {"uv": [7, 7, 9, 9], "texture": "#0"}, - "down": {"uv": [7, 7, 9, 9], "texture": "#0", "cullface": "down"} + "up": {"uv": [7, 7, 9, 9], "rotation": 90, "texture": "#0"}, + "down": {"uv": [7, 7, 9, 9], "rotation": 270, "texture": "#0", "cullface": "down"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool.json b/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool.json index 92d2aaf42..8bed79290 100644 --- a/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool.json +++ b/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool.json @@ -1,61 +1,58 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { - "from": [7.125, 1, 7], - "to": [9.125, 10, 9], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [7, 1, 7.125], + "to": [9, 10, 9.125], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 9], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 9], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 9], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 9], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "west": {"uv": [0, 0, 2, 9], "texture": "#legs"} } }, { - "from": [5.125, 0, 5], - "to": [11.125, 1, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [5, 0, 5.125], + "to": [11, 1, 11.125], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 6, 1], "texture": "#legs"}, "east": {"uv": [0, 0, 6, 1], "texture": "#legs"}, "south": {"uv": [0, 0, 6, 1], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 1], "texture": "#legs"}, - "up": {"uv": [0, 0, 6, 6], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 6, 6], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 6, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 6, 6], "texture": "#legs", "cullface": "down"} } }, { - "from": [4.625, 10, 4.5], - "to": [11.625, 12, 11.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [4.5, 10, 4.625], + "to": [11.5, 12, 11.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 9, 2], "texture": "#base"}, - "east": {"uv": [0, 0, 7, 2], "texture": "#base"}, - "south": {"uv": [1, 5, 10, 7], "texture": "#base"}, - "west": {"uv": [0, 0, 7, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 8, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 8, 8], "texture": "#base"} + "north": {"uv": [0, 0, 7, 2], "texture": "#base"}, + "east": {"uv": [0, 0, 9, 2], "texture": "#base"}, + "south": {"uv": [0, 0, 7, 2], "texture": "#base"}, + "west": {"uv": [1, 5, 10, 7], "texture": "#base"}, + "up": {"uv": [1, 1, 8, 8], "rotation": 90, "texture": "#base"}, + "down": {"uv": [1, 1, 8, 8], "rotation": 270, "texture": "#base"} } }, { - "from": [4.625, 12, 9.5], - "to": [11.625, 15, 11.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [4.5, 12, 4.625], + "to": [6.5, 15, 11.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 2, 8, 5], "texture": "#base"}, - "east": {"uv": [0, 2, 2, 5], "texture": "#base"}, - "south": {"uv": [1, 2, 8, 5], "texture": "#base"}, - "west": {"uv": [0, 2, 2, 5], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 2], "texture": "#base"}, - "down": {"uv": [4, 2, 13, 4], "texture": "#base"} + "north": {"uv": [0, 2, 2, 5], "texture": "#base"}, + "east": {"uv": [1, 2, 8, 5], "texture": "#base"}, + "south": {"uv": [0, 2, 2, 5], "texture": "#base"}, + "west": {"uv": [1, 2, 8, 5], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 2], "rotation": 90, "texture": "#base"} } } ], @@ -85,7 +82,7 @@ "scale": [0.39, 0.39, 0.39] }, "gui": { - "rotation": [30, -135, 0], + "rotation": [30, -45, 0], "translation": [0.5, -0.25, 0], "scale": [0.81, 0.81, 0.81] }, diff --git a/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool_tucked.json b/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool_tucked.json index f9ac58aa6..5fd2a869d 100644 --- a/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/modern_stool/modern_stool_tucked.json @@ -1,61 +1,58 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { - "from": [7.125, 1, -1], - "to": [9.125, 10, 1], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [15, 1, 7.125], + "to": [17, 10, 9.125], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 9], "texture": "#legs"}, - "east": {"uv": [0, 0, 2, 9], "texture": "#legs"}, + "east": {"uv": [0, 0, 2, 9], "texture": "#legs", "cullface": "east"}, "south": {"uv": [0, 0, 2, 9], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 9], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "west": {"uv": [0, 0, 2, 9], "texture": "#legs"} } }, { - "from": [5.125, 0, -3], - "to": [11.125, 1, 3], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [13, 0, 5.125], + "to": [19, 1, 11.125], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 6, 1], "texture": "#legs"}, - "east": {"uv": [0, 0, 6, 1], "texture": "#legs"}, + "east": {"uv": [0, 0, 6, 1], "texture": "#legs", "cullface": "east"}, "south": {"uv": [0, 0, 6, 1], "texture": "#legs"}, "west": {"uv": [0, 0, 6, 1], "texture": "#legs"}, - "up": {"uv": [0, 0, 6, 6], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 6, 6], "rotation": 90, "texture": "#legs"} + "up": {"uv": [0, 0, 6, 6], "texture": "#legs"}, + "down": {"uv": [0, 0, 6, 6], "texture": "#legs", "cullface": "down"} } }, { - "from": [4.625, 10, -3.5], - "to": [11.625, 12, 3.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [12.5, 10, 4.625], + "to": [19.5, 12, 11.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 9, 2], "texture": "#base"}, - "east": {"uv": [0, 0, 7, 2], "texture": "#base"}, - "south": {"uv": [1, 5, 10, 7], "texture": "#base"}, - "west": {"uv": [0, 0, 7, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 8, 8], "texture": "#base"}, - "down": {"uv": [1, 1, 8, 8], "texture": "#base"} + "north": {"uv": [0, 0, 7, 2], "texture": "#base"}, + "east": {"uv": [0, 0, 9, 2], "texture": "#base", "cullface": "east"}, + "south": {"uv": [0, 0, 7, 2], "texture": "#base"}, + "west": {"uv": [1, 5, 10, 7], "texture": "#base"}, + "up": {"uv": [1, 1, 8, 8], "rotation": 90, "texture": "#base"}, + "down": {"uv": [1, 1, 8, 8], "rotation": 270, "texture": "#base"} } }, { - "from": [4.625, 12, 1.5], - "to": [11.625, 15, 3.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [12.5, 12, 4.625], + "to": [14.5, 15, 11.625], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [1, 2, 8, 5], "texture": "#base"}, - "east": {"uv": [0, 2, 2, 5], "texture": "#base"}, - "south": {"uv": [1, 2, 8, 5], "texture": "#base"}, - "west": {"uv": [0, 2, 2, 5], "texture": "#base"}, - "up": {"uv": [6, 1, 11, 2], "texture": "#base"}, - "down": {"uv": [4, 2, 13, 4], "texture": "#base"} + "north": {"uv": [0, 2, 2, 5], "texture": "#base"}, + "east": {"uv": [1, 2, 8, 5], "texture": "#base"}, + "south": {"uv": [0, 2, 2, 5], "texture": "#base"}, + "west": {"uv": [1, 2, 8, 5], "texture": "#base"}, + "up": {"uv": [6, 1, 11, 2], "rotation": 90, "texture": "#base"} } } ], diff --git a/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool.json b/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool.json index b1ad84d6b..ee34c4d37 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool_tucked.json b/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool_tucked.json index a047b107b..1b1215e9d 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool_tucked.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_stool/simple_stool_tucked.json @@ -1,74 +1,70 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log" }, "elements": [ { - "from": [3.5, 0, -4.5], - "to": [5.5, 10, -2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [18.5, 0, 3.5], + "to": [20.5, 10, 5.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "north": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.5, 0, -4.5], - "to": [12.5, 10, -2.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [18.5, 0, 10.5], + "to": [20.5, 10, 12.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { - "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "north": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "east": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "south": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "west": {"uv": [0, 0, 2, 10], "texture": "#legs", "cullface": "east"}, + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [10.5, 0, 2.5], - "to": [12.5, 10, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 0, 10.5], + "to": [13.5, 10, 12.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } }, { - "from": [3.5, 10, -4.5], - "to": [12.5, 12, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 10, 3.5], + "to": [20.5, 12, 12.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 9, 2], "texture": "#base"}, - "east": {"uv": [0, 0, 9, 2], "texture": "#base"}, + "east": {"uv": [0, 0, 9, 2], "texture": "#base", "cullface": "east"}, "south": {"uv": [0, 0, 9, 2], "texture": "#base"}, "west": {"uv": [0, 0, 9, 2], "texture": "#base"}, - "up": {"uv": [1, 1, 10, 10], "texture": "#base"}, - "down": {"uv": [1, 1, 10, 10], "texture": "#base"} + "up": {"uv": [1, 1, 10, 10], "rotation": 90, "texture": "#base"}, + "down": {"uv": [1, 1, 10, 10], "rotation": 270, "texture": "#base"} } }, { - "from": [3.5, 0, 2.5], - "to": [5.5, 10, 4.5], - "rotation": {"angle": 0, "axis": "y", "origin": [7, 0, 8]}, + "from": [11.5, 0, 3.5], + "to": [13.5, 10, 5.5], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, "faces": { "north": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "east": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "south": {"uv": [0, 0, 2, 10], "texture": "#legs"}, "west": {"uv": [0, 0, 2, 10], "texture": "#legs"}, - "up": {"uv": [0, 0, 2, 2], "rotation": 270, "texture": "#legs"}, - "down": {"uv": [0, 0, 2, 2], "rotation": 90, "texture": "#legs"} + "down": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "down"} } } ], diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/FabricChairModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/FabricChairModel.java new file mode 100644 index 000000000..8cbadd5f3 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/FabricChairModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.chair.fabric; + +import com.unlikepaladin.pfm.blocks.BasicChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricChairModel extends PFMFabricBakedModel { + public FabricChairModel(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.getBlock() instanceof BasicChairBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(BasicChairBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java new file mode 100644 index 000000000..8cfc302dc --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/fabric/UnbakedChairModelImpl.java @@ -0,0 +1,20 @@ +package com.unlikepaladin.pfm.blocks.models.chair.fabric; + +import com.unlikepaladin.pfm.blocks.models.classicNightstand.fabric.FabricClassicNightstandModel; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricChairModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/FabricChairClassicModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/FabricChairClassicModel.java new file mode 100644 index 000000000..79dfd352b --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/FabricChairClassicModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.chairClassic.fabric; + +import com.unlikepaladin.pfm.blocks.ClassicChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricChairClassicModel extends PFMFabricBakedModel { + public FabricChairClassicModel(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.getBlock() instanceof ClassicChairBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(ClassicChairBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java new file mode 100644 index 000000000..c6d3065cb --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/fabric/UnbakedChairClassicModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.chairClassic.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairClassicModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricChairClassicModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/FabricChairDinnerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/FabricChairDinnerModel.java new file mode 100644 index 000000000..4c1d15e13 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/FabricChairDinnerModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.chairDinner.fabric; + +import com.unlikepaladin.pfm.blocks.DinnerChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricChairDinnerModel extends PFMFabricBakedModel { + public FabricChairDinnerModel(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.getBlock() instanceof DinnerChairBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(DinnerChairBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java new file mode 100644 index 000000000..31ca1a653 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/fabric/UnbakedChairDinnerModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.chairDinner.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairDinnerModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricChairDinnerModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/FabricChairModernModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/FabricChairModernModel.java new file mode 100644 index 000000000..7b0a1b95f --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/FabricChairModernModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.chairModern.fabric; + +import com.unlikepaladin.pfm.blocks.ModernChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricChairModernModel extends PFMFabricBakedModel { + public FabricChairModernModel(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.getBlock() instanceof ModernChairBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(ModernChairBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java new file mode 100644 index 000000000..358e63747 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/fabric/UnbakedChairModernModelImpl.java @@ -0,0 +1,20 @@ +package com.unlikepaladin.pfm.blocks.models.chairModern.fabric; + +import com.unlikepaladin.pfm.blocks.models.chairDinner.fabric.FabricChairDinnerModel; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairModernModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricChairModernModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java index 8149ad120..53a3aa659 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/fabric/FabricClassicNightstandModel.java @@ -1,7 +1,6 @@ package com.unlikepaladin.pfm.blocks.models.classicNightstand.fabric; import com.unlikepaladin.pfm.blocks.ClassicNightstandBlock; -import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.fabric.PFMFabricBakedModel; import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; @@ -16,7 +15,6 @@ import net.minecraft.world.BlockRenderView; import java.util.List; -import java.util.Map; import java.util.Random; import java.util.function.Supplier; @@ -39,7 +37,7 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean right = block.isStand(world, pos, dir.rotateYClockwise(), dir); int openIndexOffset = state.get(ClassicNightstandBlock.OPEN) ? 4 : 0; List spriteList = getSpriteList(state); - pushTextureTransform(context, ModelHelper.getOakSprites(), spriteList); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); if (left && right) { ((FabricBakedModel) getTemplateBakedModels().get((openIndexOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } else if (!left && right) { @@ -56,7 +54,7 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { List spriteList = getSpriteList(stack); - pushTextureTransform(context, ModelHelper.getOakSprites(), spriteList); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); ((FabricBakedModel) getTemplateBakedModels().get((3))).emitItemQuads(stack, randomSupplier, context); context.popTransform(); } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/FabricClassicStoolModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/FabricClassicStoolModel.java new file mode 100644 index 000000000..8a3c82f08 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/FabricClassicStoolModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.classicStool.fabric; + +import com.unlikepaladin.pfm.blocks.ClassicStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricClassicStoolModel extends PFMFabricBakedModel { + public FabricClassicStoolModel(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.getBlock() instanceof ClassicStoolBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(ClassicStoolBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java new file mode 100644 index 000000000..fba7cebfc --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/fabric/UnbakedClassicStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.classicStool.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedClassicStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricClassicStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/FabricLogStoolModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/FabricLogStoolModel.java new file mode 100644 index 000000000..b6ebb8e9c --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/FabricLogStoolModel.java @@ -0,0 +1,54 @@ +package com.unlikepaladin.pfm.blocks.models.logStool.fabric; + +import com.unlikepaladin.pfm.blocks.LogStoolBlock; +import com.unlikepaladin.pfm.blocks.ModernStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricLogStoolModel extends PFMFabricBakedModel { + public FabricLogStoolModel(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.getBlock() instanceof LogStoolBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakLogLogTopSprites(), spriteList); + int tucked = state.get(LogStoolBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakLogLogTopSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java new file mode 100644 index 000000000..7534d914a --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/fabric/UnbakedLogStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.logStool.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedLogStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricLogStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/FabricModernStoolModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/FabricModernStoolModel.java new file mode 100644 index 000000000..083c792e9 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/FabricModernStoolModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.modernStool.fabric; + +import com.unlikepaladin.pfm.blocks.ModernStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricModernStoolModel extends PFMFabricBakedModel { + public FabricModernStoolModel(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.getBlock() instanceof ModernStoolBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(ModernStoolBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java new file mode 100644 index 000000000..ebe4a2307 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/fabric/UnbakedModernStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.modernStool.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedModernStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricModernStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/FabricSimpleStoolModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/FabricSimpleStoolModel.java new file mode 100644 index 000000000..b96dee289 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/FabricSimpleStoolModel.java @@ -0,0 +1,53 @@ +package com.unlikepaladin.pfm.blocks.models.simpleStool.fabric; + +import com.unlikepaladin.pfm.blocks.SimpleStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricSimpleStoolModel extends PFMFabricBakedModel { + public FabricSimpleStoolModel(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.getBlock() instanceof SimpleStoolBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + int tucked = state.get(SimpleStoolBlock.TUCKED) ? 1 : 0; + ((FabricBakedModel) getTemplateBakedModels().get(tucked)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java new file mode 100644 index 000000000..2b8c1df81 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/fabric/UnbakedSimpleStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.simpleStool.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedSimpleStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricSimpleStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} 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 753a95ea1..fa9cc54f8 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 @@ -3,7 +3,12 @@ import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; import com.unlikepaladin.pfm.blocks.models.basicTable.UnbakedBasicTableModel; import com.unlikepaladin.pfm.blocks.models.bed.UnbakedBedModel; +import com.unlikepaladin.pfm.blocks.models.chair.UnbakedChairModel; +import com.unlikepaladin.pfm.blocks.models.chairClassic.UnbakedChairClassicModel; +import com.unlikepaladin.pfm.blocks.models.chairDinner.UnbakedChairDinnerModel; +import com.unlikepaladin.pfm.blocks.models.chairModern.UnbakedChairModernModel; import com.unlikepaladin.pfm.blocks.models.classicNightstand.UnbakedClassicNightstandModel; +import com.unlikepaladin.pfm.blocks.models.classicStool.UnbakedClassicStoolModel; import com.unlikepaladin.pfm.blocks.models.classicTable.UnbakedClassicTableModel; import com.unlikepaladin.pfm.blocks.models.dinnerTable.UnbakedDinnerTableModel; import com.unlikepaladin.pfm.blocks.models.fridge.UnbakedFreezerModel; @@ -15,14 +20,16 @@ import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; +import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.UnbakedModernDinnerTableModel; +import com.unlikepaladin.pfm.blocks.models.modernStool.UnbakedModernStoolModel; +import com.unlikepaladin.pfm.blocks.models.simpleStool.UnbakedSimpleStoolModel; import net.fabricmc.fabric.api.client.model.ExtraModelProvider; import net.minecraft.resource.ResourceManager; import net.minecraft.util.Identifier; -import java.util.Arrays; import java.util.function.Consumer; public class PFMExtraModelProvider implements ExtraModelProvider { @@ -47,6 +54,30 @@ public void provideExtraModels(ResourceManager manager, Consumer out for (Identifier id : UnbakedClassicNightstandModel.NIGHTSTAND_MODEL_PARTS_BASE) { out.accept(id); } + for (Identifier id : UnbakedChairModel.CHAIR_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedChairDinnerModel.CHAIR_DINNER_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedChairModernModel.CHAIR_MODERN_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedChairClassicModel.CHAIR_CLASSIC_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedSimpleStoolModel.SIMPLE_STOOL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedClassicStoolModel.CLASSIC_STOOL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedModernStoolModel.MODERN_STOOL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedLogStoolModel.LOG_STOOL_PARTS_BASE) { + out.accept(id); + } UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(out::accept); UnbakedKitchenWallCounterModel.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 b63944f50..7bdb0624b 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 @@ -4,7 +4,12 @@ import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; import com.unlikepaladin.pfm.blocks.models.basicTable.UnbakedBasicTableModel; import com.unlikepaladin.pfm.blocks.models.bed.UnbakedBedModel; +import com.unlikepaladin.pfm.blocks.models.chair.UnbakedChairModel; +import com.unlikepaladin.pfm.blocks.models.chairClassic.UnbakedChairClassicModel; +import com.unlikepaladin.pfm.blocks.models.chairDinner.UnbakedChairDinnerModel; +import com.unlikepaladin.pfm.blocks.models.chairModern.UnbakedChairModernModel; import com.unlikepaladin.pfm.blocks.models.classicNightstand.UnbakedClassicNightstandModel; +import com.unlikepaladin.pfm.blocks.models.classicStool.UnbakedClassicStoolModel; import com.unlikepaladin.pfm.blocks.models.classicTable.UnbakedClassicTableModel; import com.unlikepaladin.pfm.blocks.models.dinnerTable.UnbakedDinnerTableModel; import com.unlikepaladin.pfm.blocks.models.fridge.UnbakedFreezerModel; @@ -16,9 +21,12 @@ import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; +import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.UnbakedModernDinnerTableModel; +import com.unlikepaladin.pfm.blocks.models.modernStool.UnbakedModernStoolModel; +import com.unlikepaladin.pfm.blocks.models.simpleStool.UnbakedSimpleStoolModel; import net.fabricmc.fabric.api.client.model.ModelProviderContext; import net.fabricmc.fabric.api.client.model.ModelResourceProvider; import net.minecraft.client.render.model.UnbakedModel; @@ -53,6 +61,30 @@ else if (UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.contains(resourceId)){ else if (UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.contains(resourceId)){ return new UnbakedClassicNightstandModel(); } + else if (UnbakedChairModel.CHAIR_MODEL_IDS.contains(resourceId)){ + return new UnbakedChairModel(); + } + else if (UnbakedChairDinnerModel.CHAIR_DINNER_MODEL_IDS.contains(resourceId)){ + return new UnbakedChairDinnerModel(); + } + else if (UnbakedChairModernModel.CHAIR_MODERN_MODEL_IDS.contains(resourceId)){ + return new UnbakedChairModernModel(); + } + else if (UnbakedChairClassicModel.CHAIR_CLASSIC_MODEL_IDS.contains(resourceId)){ + return new UnbakedChairClassicModel(); + } + else if (UnbakedSimpleStoolModel.SIMPLE_STOOL_MODEL_IDS.contains(resourceId)){ + return new UnbakedSimpleStoolModel(); + } + else if (UnbakedClassicStoolModel.CLASSIC_STOOL_MODEL_IDS.contains(resourceId)){ + return new UnbakedClassicStoolModel(); + } + else if (UnbakedModernStoolModel.MODERN_STOOL_MODEL_IDS.contains(resourceId)){ + return new UnbakedModernStoolModel(); + } + else if (UnbakedLogStoolModel.LOG_STOOL_MODEL_IDS.contains(resourceId)){ + return new UnbakedLogStoolModel(); + } else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ return new UnbakedKitchenCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/ForgeChairModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/ForgeChairModel.java new file mode 100644 index 000000000..87c1ceacb --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/ForgeChairModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.chair.forge; + +import com.unlikepaladin.pfm.blocks.BasicChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeChairModel extends PFMForgeBakedModel { + public ForgeChairModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof BasicChairBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(BasicChairBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java new file mode 100644 index 000000000..0de1596ad --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chair/forge/UnbakedChairModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.chair.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeChairModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/ForgeChairClassicModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/ForgeChairClassicModel.java new file mode 100644 index 000000000..449f9c366 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/ForgeChairClassicModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.chairClassic.forge; + +import com.unlikepaladin.pfm.blocks.ClassicChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeChairClassicModel extends PFMForgeBakedModel { + public ForgeChairClassicModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof ClassicChairBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(ClassicChairBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java new file mode 100644 index 000000000..66a6f7447 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairClassic/forge/UnbakedChairClassicModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.chairClassic.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairClassicModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeChairClassicModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/ForgeChairDinnerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/ForgeChairDinnerModel.java new file mode 100644 index 000000000..d376afb8f --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/ForgeChairDinnerModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.chairDinner.forge; + +import com.unlikepaladin.pfm.blocks.DinnerChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeChairDinnerModel extends PFMForgeBakedModel { + public ForgeChairDinnerModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof DinnerChairBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(DinnerChairBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java new file mode 100644 index 000000000..8dd579ee0 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairDinner/forge/UnbakedChairDinnerModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.chairDinner.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairDinnerModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeChairDinnerModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/ForgeChairModernModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/ForgeChairModernModel.java new file mode 100644 index 000000000..f91d43c51 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/ForgeChairModernModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.chairModern.forge; + +import com.unlikepaladin.pfm.blocks.ModernChairBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeChairModernModel extends PFMForgeBakedModel { + public ForgeChairModernModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof ModernChairBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(ModernChairBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java new file mode 100644 index 000000000..57c7f19c2 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/chairModern/forge/UnbakedChairModernModelImpl.java @@ -0,0 +1,20 @@ +package com.unlikepaladin.pfm.blocks.models.chairModern.forge; + +import com.unlikepaladin.pfm.blocks.models.chairDinner.forge.ForgeChairDinnerModel; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedChairModernModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeChairModernModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java index ca32f1dd0..33e8fdf24 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicNightstand/forge/ForgeClassicNightstandModel.java @@ -1,7 +1,6 @@ package com.unlikepaladin.pfm.blocks.models.classicNightstand.forge; import com.unlikepaladin.pfm.blocks.ClassicNightstandBlock; -import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; @@ -47,7 +46,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction originalQuads.addAll(getTemplateBakedModels().get(3+openIndexOffset).getQuads(state, side, rand, extraData)); } List spriteList = getSpriteList(state); - return getQuadsWithTexture(originalQuads, ModelHelper.getOakSprites(), spriteList); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); } return Collections.emptyList(); } @@ -85,7 +84,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos @Override public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { List spriteList = getSpriteList(stack); - List originalQuads = new ArrayList<>(getTemplateBakedModels().get(3).getQuads(state, face, random)); - return getQuadsWithTexture(originalQuads, ModelHelper.getOakSprites(), spriteList); + List originalQuads = getTemplateBakedModels().get(3).getQuads(state, face, random); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/ForgeClassicStoolModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/ForgeClassicStoolModel.java new file mode 100644 index 000000000..f4a8437c7 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/ForgeClassicStoolModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.classicStool.forge; + +import com.unlikepaladin.pfm.blocks.ClassicStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeClassicStoolModel extends PFMForgeBakedModel { + public ForgeClassicStoolModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof ClassicStoolBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(ClassicStoolBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java new file mode 100644 index 000000000..dd8269033 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/classicStool/forge/UnbakedClassicStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.classicStool.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedClassicStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeClassicStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/ForgeLogStoolModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/ForgeLogStoolModel.java new file mode 100644 index 000000000..f8c04f2e0 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/ForgeLogStoolModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.logStool.forge; + +import com.unlikepaladin.pfm.blocks.LogStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeLogStoolModel extends PFMForgeBakedModel { + public ForgeLogStoolModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof LogStoolBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(LogStoolBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakLogLogTopSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakLogLogTopSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java new file mode 100644 index 000000000..bc6e1b9c2 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/logStool/forge/UnbakedLogStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.logStool.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedLogStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeLogStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/ForgeModernStoolModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/ForgeModernStoolModel.java new file mode 100644 index 000000000..b51043efa --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/ForgeModernStoolModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.modernStool.forge; + +import com.unlikepaladin.pfm.blocks.ModernStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeModernStoolModel extends PFMForgeBakedModel { + public ForgeModernStoolModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof ModernStoolBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(ModernStoolBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java new file mode 100644 index 000000000..252689923 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/modernStool/forge/UnbakedModernStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.modernStool.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedModernStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeModernStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/ForgeSimpleStoolModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/ForgeSimpleStoolModel.java new file mode 100644 index 000000000..812b1ba88 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/ForgeSimpleStoolModel.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.blocks.models.simpleStool.forge; + +import com.unlikepaladin.pfm.blocks.SimpleStoolBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.Collections; +import java.util.List; +import java.util.Random; + +public class ForgeSimpleStoolModel extends PFMForgeBakedModel { + public ForgeSimpleStoolModel(ModelBakeSettings settings, List templateBakedModels) { + super(settings, templateBakedModels); + } + + public static ModelProperty TUCKED = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(TUCKED); + } + + + @Override + public @NotNull IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof SimpleStoolBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(TUCKED, state.get(SimpleStoolBlock.TUCKED)); + return data; + } + return tileData; + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData != null && extraData.getData(TUCKED) != null) { + int tucked = Boolean.TRUE.equals(extraData.getData(TUCKED)) ? 1 : 0; + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(tucked).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + List quads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java new file mode 100644 index 000000000..93547a119 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/simpleStool/forge/UnbakedSimpleStoolModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.simpleStool.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedSimpleStoolModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeSimpleStoolModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} 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 c57e08979..c14510754 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 @@ -3,7 +3,12 @@ import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; import com.unlikepaladin.pfm.blocks.models.basicTable.UnbakedBasicTableModel; import com.unlikepaladin.pfm.blocks.models.bed.UnbakedBedModel; +import com.unlikepaladin.pfm.blocks.models.chair.UnbakedChairModel; +import com.unlikepaladin.pfm.blocks.models.chairClassic.UnbakedChairClassicModel; +import com.unlikepaladin.pfm.blocks.models.chairDinner.UnbakedChairDinnerModel; +import com.unlikepaladin.pfm.blocks.models.chairModern.UnbakedChairModernModel; import com.unlikepaladin.pfm.blocks.models.classicNightstand.UnbakedClassicNightstandModel; +import com.unlikepaladin.pfm.blocks.models.classicStool.UnbakedClassicStoolModel; import com.unlikepaladin.pfm.blocks.models.classicTable.UnbakedClassicTableModel; import com.unlikepaladin.pfm.blocks.models.dinnerTable.UnbakedDinnerTableModel; import com.unlikepaladin.pfm.blocks.models.fridge.UnbakedFreezerModel; @@ -15,9 +20,12 @@ import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; +import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.UnbakedModernDinnerTableModel; +import com.unlikepaladin.pfm.blocks.models.modernStool.UnbakedModernStoolModel; +import com.unlikepaladin.pfm.blocks.models.simpleStool.UnbakedSimpleStoolModel; import com.unlikepaladin.pfm.client.PaladinFurnitureModClient; import com.unlikepaladin.pfm.client.ScreenRegistry; import com.unlikepaladin.pfm.client.screens.*; @@ -88,6 +96,30 @@ public static void registerExtraModels(ModelRegistryEvent event) { for (Identifier id : UnbakedClassicNightstandModel.NIGHTSTAND_MODEL_PARTS_BASE) { ModelLoader.addSpecialModel(id); } + for (Identifier id : UnbakedChairModel.CHAIR_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedChairDinnerModel.CHAIR_DINNER_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedChairModernModel.CHAIR_MODERN_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedChairClassicModel.CHAIR_CLASSIC_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedSimpleStoolModel.SIMPLE_STOOL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedClassicStoolModel.CLASSIC_STOOL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedModernStoolModel.MODERN_STOOL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedLogStoolModel.LOG_STOOL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); UnbakedKitchenWallCounterModel.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 f43652f7f..5a94ccd3e 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 @@ -4,7 +4,12 @@ import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; import com.unlikepaladin.pfm.blocks.models.basicTable.UnbakedBasicTableModel; import com.unlikepaladin.pfm.blocks.models.bed.UnbakedBedModel; +import com.unlikepaladin.pfm.blocks.models.chair.UnbakedChairModel; +import com.unlikepaladin.pfm.blocks.models.chairClassic.UnbakedChairClassicModel; +import com.unlikepaladin.pfm.blocks.models.chairDinner.UnbakedChairDinnerModel; +import com.unlikepaladin.pfm.blocks.models.chairModern.UnbakedChairModernModel; import com.unlikepaladin.pfm.blocks.models.classicNightstand.UnbakedClassicNightstandModel; +import com.unlikepaladin.pfm.blocks.models.classicStool.UnbakedClassicStoolModel; import com.unlikepaladin.pfm.blocks.models.classicTable.UnbakedClassicTableModel; import com.unlikepaladin.pfm.blocks.models.dinnerTable.UnbakedDinnerTableModel; import com.unlikepaladin.pfm.blocks.models.fridge.UnbakedFreezerModel; @@ -16,11 +21,14 @@ import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.UnbakedKitchenWallCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.UnbakedKitchenWallDrawerModel; +import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.modernDinnerTable.UnbakedModernDinnerTableModel; +import com.unlikepaladin.pfm.blocks.models.modernStool.UnbakedModernStoolModel; +import com.unlikepaladin.pfm.blocks.models.simpleStool.UnbakedSimpleStoolModel; import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.util.ModelIdentifier; @@ -156,5 +164,53 @@ else if (ModelHelper.containsIdentifier(UnbakedBasicLampModel.LAMP_MODEL_IDS.toA this.modelsToBake.put(resourceId, model); ci.cancel(); } + else if (UnbakedChairModel.CHAIR_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedChairModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedChairDinnerModel.CHAIR_DINNER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedChairDinnerModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedChairModernModel.CHAIR_MODERN_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedChairModernModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedChairClassicModel.CHAIR_CLASSIC_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedChairClassicModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedSimpleStoolModel.SIMPLE_STOOL_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedSimpleStoolModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedClassicStoolModel.CLASSIC_STOOL_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedClassicStoolModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedModernStoolModel.MODERN_STOOL_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedModernStoolModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedLogStoolModel.LOG_STOOL_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedLogStoolModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } } } \ No newline at end of file From 1fdfc4903546095e27c77575ea42119aa2de74c8 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Fri, 22 Dec 2023 19:22:33 -0600 Subject: [PATCH 04/10] migrated beds to the new model system, they now use a hybrid baked model + block entity renderer system --- .../pfm/blocks/SimpleBedBlock.java | 10 +- .../blockentities/PFMBedBlockEntity.java | 49 ++++++++ .../pfm/blocks/models/AbstractBakedModel.java | 18 ++- .../pfm/blocks/models/ModelHelper.java | 11 ++ .../blocks/models/bed/UnbakedBedModel.java | 111 +++++++----------- .../pfm/client/EntityRenderIDs.java | 3 + .../pfm/client/EntityRenderRegistry.java | 5 + .../client/PFMBakedModelManagerAccessor.java | 9 ++ .../PFMBuiltinItemRendererExtension.java | 5 + .../pfm/client/PFMItemRenderer.java | 92 +++++++++++++++ .../render/PFMBedBlockEntityRenderer.java | 97 +++++++++++++++ .../com/unlikepaladin/pfm/items/DyeKit.java | 13 +- .../pfm/mixin/PFMBakedModelManagerMixin.java | 24 ++++ .../pfm/mixin/PFMItemRendererMixin.java | 30 +++++ .../pfm/registry/BlockEntities.java | 1 + .../pfm/registry/BlockEntityRegistry.java | 1 + .../pfm/registry/dynamic/FurnitureEntry.java | 37 +++--- .../assets/PFMBlockstateModelProvider.java | 37 +++++- .../pfm/runtime/assets/PFMLangProvider.java | 2 +- .../mattresses/black_foot_mattress.json | 8 -- .../mattresses/black_head_mattress.json | 8 -- .../mattresses/blue_foot_mattress.json | 8 -- .../mattresses/blue_head_mattress.json | 8 -- .../mattresses/brown_foot_mattress.json | 8 -- .../mattresses/brown_head_mattress.json | 8 -- .../mattresses/cyan_foot_mattress.json | 8 -- .../mattresses/cyan_head_mattress.json | 8 -- .../mattresses/gray_foot_mattress.json | 8 -- .../mattresses/gray_head_mattress.json | 8 -- .../mattresses/green_foot_mattress.json | 8 -- .../mattresses/green_head_mattress.json | 8 -- .../mattresses/light_blue_foot_mattress.json | 8 -- .../mattresses/light_blue_head_mattress.json | 8 -- .../mattresses/light_gray_foot_mattress.json | 8 -- .../mattresses/light_gray_head_mattress.json | 8 -- .../mattresses/lime_foot_mattress.json | 8 -- .../mattresses/lime_head_mattress.json | 8 -- .../mattresses/magenta_foot_mattress.json | 8 -- .../mattresses/magenta_head_mattress.json | 8 -- .../mattresses/orange_foot_mattress.json | 8 -- .../mattresses/orange_head_mattress.json | 8 -- .../mattresses/pink_foot_mattress.json | 8 -- .../mattresses/pink_head_mattress.json | 8 -- .../mattresses/purple_foot_mattress.json | 8 -- .../mattresses/purple_head_mattress.json | 8 -- .../mattresses/red_head_mattress.json | 23 +++- .../mattresses/white_foot_mattress.json | 8 -- .../mattresses/white_head_mattress.json | 8 -- .../mattresses/yellow_foot_mattress.json | 8 -- .../mattresses/yellow_head_mattress.json | 8 -- .../bunk/foot/classic_bed_foot_left.json | 4 +- .../bunk/foot/classic_bed_foot_right.json | 4 +- .../template/foot/classic_bed_foot.json | 2 +- .../template/foot/classic_bed_foot_left.json | 4 +- .../template/foot/classic_bed_foot_right.json | 4 +- .../template/full/classic_bed.json | 59 +--------- .../template/full/classic_bed_black.json | 8 -- .../template/full/classic_bed_blue.json | 8 -- .../template/full/classic_bed_brown.json | 8 -- .../template/full/classic_bed_cyan.json | 8 -- .../template/full/classic_bed_gray.json | 8 -- .../template/full/classic_bed_green.json | 8 -- .../template/full/classic_bed_light_blue.json | 8 -- .../template/full/classic_bed_light_gray.json | 8 -- .../template/full/classic_bed_lime.json | 8 -- .../template/full/classic_bed_magenta.json | 8 -- .../template/full/classic_bed_orange.json | 8 -- .../template/full/classic_bed_pink.json | 8 -- .../template/full/classic_bed_purple.json | 8 -- .../template/full/classic_bed_red.json | 8 -- .../template/full/classic_bed_white.json | 8 -- .../template/full/classic_bed_yellow.json | 8 -- .../template/head/classic_bed_head.json | 28 +---- .../template/head/classic_bed_head_left.json | 4 +- .../template/head/classic_bed_head_right.json | 4 +- .../mattresses/black_foot_mattress.json | 8 -- .../mattresses/black_head_mattress.json | 8 -- .../mattresses/blue_foot_mattress.json | 8 -- .../mattresses/blue_head_mattress.json | 8 -- .../mattresses/brown_foot_mattress.json | 8 -- .../mattresses/brown_head_mattress.json | 8 -- .../mattresses/cyan_foot_mattress.json | 8 -- .../mattresses/cyan_head_mattress.json | 8 -- .../mattresses/gray_foot_mattress.json | 8 -- .../mattresses/gray_head_mattress.json | 8 -- .../mattresses/green_foot_mattress.json | 8 -- .../mattresses/green_head_mattress.json | 8 -- .../mattresses/light_blue_foot_mattress.json | 8 -- .../mattresses/light_blue_head_mattress.json | 8 -- .../mattresses/light_gray_foot_mattress.json | 8 -- .../mattresses/light_gray_head_mattress.json | 8 -- .../mattresses/lime_foot_mattress.json | 8 -- .../mattresses/lime_head_mattress.json | 8 -- .../mattresses/magenta_foot_mattress.json | 8 -- .../mattresses/magenta_head_mattress.json | 8 -- .../mattresses/orange_foot_mattress.json | 8 -- .../mattresses/orange_head_mattress.json | 8 -- .../mattresses/pink_foot_mattress.json | 8 -- .../mattresses/pink_head_mattress.json | 8 -- .../mattresses/purple_foot_mattress.json | 8 -- .../mattresses/purple_head_mattress.json | 8 -- .../mattresses/white_foot_mattress.json | 8 -- .../mattresses/white_head_mattress.json | 8 -- .../mattresses/yellow_foot_mattress.json | 8 -- .../mattresses/yellow_head_mattress.json | 8 -- .../bunk/foot/simple_bed_foot_left.json | 2 +- .../bunk/foot/simple_bed_foot_right.json | 2 +- .../template/bunk/head/simple_bed_head.json | 4 +- .../template/foot/simple_bed_foot.json | 2 +- .../template/foot/simple_bed_foot_left.json | 4 +- .../template/foot/simple_bed_foot_right.json | 4 +- .../simple_bed/template/full/simple_bed.json | 46 +------- .../template/full/simple_bed_black.json | 8 -- .../template/full/simple_bed_blue.json | 8 -- .../template/full/simple_bed_brown.json | 8 -- .../template/full/simple_bed_cyan.json | 8 -- .../template/full/simple_bed_gray.json | 8 -- .../template/full/simple_bed_green.json | 8 -- .../template/full/simple_bed_light_blue.json | 8 -- .../template/full/simple_bed_light_gray.json | 8 -- .../template/full/simple_bed_lime.json | 8 -- .../template/full/simple_bed_magenta.json | 8 -- .../template/full/simple_bed_orange.json | 8 -- .../template/full/simple_bed_pink.json | 8 -- .../template/full/simple_bed_purple.json | 8 -- .../template/full/simple_bed_red.json | 8 -- .../template/full/simple_bed_white.json | 8 -- .../template/full/simple_bed_yellow.json | 8 -- .../template/head/simple_bed_head.json | 4 +- .../template/head/simple_bed_head_left.json | 4 +- .../template/head/simple_bed_head_right.json | 4 +- .../src/main/resources/pfm-common.mixins.json | 2 + common/src/main/resources/pfm.accesswidener | 3 +- .../models/bed/fabric/FabricBedModel.java | 38 +++--- .../bed/fabric/UnbakedBedModelImpl.java | 12 +- .../models/fabric/PFMFabricBakedModel.java | 6 +- .../fabric/EntityRenderRegistryFabric.java | 10 -- .../client/fabric/PFMExtraModelProvider.java | 4 +- .../pfm/client/fabric/PFMModelProvider.java | 4 +- .../models/bed/forge/ForgeBedModel.java | 59 ++++++---- .../models/bed/forge/UnbakedBedModelImpl.java | 11 +- .../models/forge/PFMForgeBakedModel.java | 6 +- .../pfm/client/forge/PFMItemRenderer.java | 1 - .../forge/PaladinFurnitureModClientForge.java | 5 +- .../pfm/mixin/forge/PFMModelLoaderMixin.java | 4 +- 145 files changed, 617 insertions(+), 1051 deletions(-) create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/client/PFMBakedModelManagerAccessor.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/client/PFMBuiltinItemRendererExtension.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/client/PFMItemRenderer.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/entity/render/PFMBedBlockEntityRenderer.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/mixin/PFMBakedModelManagerMixin.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/mixin/PFMItemRendererMixin.java delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_black.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_blue.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_brown.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_cyan.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_gray.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_green.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_blue.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_gray.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_lime.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_magenta.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_orange.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_pink.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_purple.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_red.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_white.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_yellow.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_foot_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_head_mattress.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_black.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_blue.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_brown.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_cyan.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_gray.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_green.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_blue.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_gray.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_lime.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_magenta.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_orange.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_pink.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_purple.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_red.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_white.json delete mode 100644 common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_yellow.json diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java index 881dfb889..e34ebc08a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java @@ -1,7 +1,10 @@ package com.unlikepaladin.pfm.blocks; +import com.unlikepaladin.pfm.blocks.blockentities.PFMBedBlockEntity; +import com.unlikepaladin.pfm.client.PFMBuiltinItemRendererExtension; import com.unlikepaladin.pfm.data.FurnitureBlock; import net.minecraft.block.*; +import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.enums.BedPart; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.pathing.NavigationType; @@ -36,7 +39,7 @@ import static com.unlikepaladin.pfm.blocks.LogTableBlock.rotateShape; -public class SimpleBedBlock extends BedBlock implements DyeableFurnitureBlock { +public class SimpleBedBlock extends BedBlock implements DyeableFurnitureBlock, PFMBuiltinItemRendererExtension { private static final List SIMPLE_BEDS = new ArrayList<>(); private final DyeColor color; public SimpleBedBlock(DyeColor color, Settings settings) { @@ -210,4 +213,9 @@ public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos po public DyeColor getPFMColor() { return color; } + + @Override + public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { + return new PFMBedBlockEntity(pos, state, this.color); + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java new file mode 100644 index 000000000..42f1ac809 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java @@ -0,0 +1,49 @@ +package com.unlikepaladin.pfm.blocks.blockentities; + +import com.unlikepaladin.pfm.registry.BlockEntities; +import net.minecraft.block.BedBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BedBlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.DyeColor; +import net.minecraft.util.math.BlockPos; + +public class PFMBedBlockEntity extends BedBlockEntity implements DyeableFurnitureBlockEntity { + private final BlockEntityType type; + public PFMBedBlockEntity(BlockPos pos, BlockState state, DyeColor color) { + super(pos, state, color); + type = BlockEntities.BED_BLOCK_ENTITY; + } + + public PFMBedBlockEntity(BlockPos pos, BlockState state) { + super(pos, state); + type = BlockEntities.BED_BLOCK_ENTITY; + } + + @Override + public void setPFMColor(DyeColor color) { + this.setColor(color); + } + + @Override + public DyeColor getPFMColor() { + return getColor(); + } + + @Override + public NbtCompound writeColor(NbtCompound nbt) { + nbt.putString("color", getColor().asString()); + return nbt; + } + + @Override + public PFMBedBlockEntity getEntity() { + return this; + } + + @Override + public BlockEntityType getType() { + return type; + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 236f4b6f4..5ca96bbe0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -2,11 +2,14 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.LogStoolBlock; +import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.entity.BedBlockEntity; +import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.render.model.ModelBakeSettings; @@ -17,7 +20,9 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.screen.PlayerScreenHandler; +import net.minecraft.util.DyeColor; import net.minecraft.util.math.Direction; +import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; import java.util.*; @@ -121,7 +126,12 @@ else if (element instanceof BlockItem) { } return Collections.singletonList(getTemplateBakedModels().get(0).getParticleSprite()); } + protected List getBedSprites(DyeColor color, BlockState state) { + List list = new ArrayList<>(3); + VariantBase variant = getVariant(state); + return list; + } private final Map> spriteList = new HashMap<>(); private List getSpriteFromState(BlockState state) { if (spriteList.containsKey(state.getBlock())) @@ -130,7 +140,13 @@ private List getSpriteFromState(BlockState state) { VariantBase variant = getVariant(state); boolean stripped = state.getBlock().getTranslationKey().contains("stripped"); List list = new ArrayList<>(3); - if (state.getBlock() instanceof LogStoolBlock) { + if (state.getBlock() instanceof SimpleBedBlock) { + DyeColor color = ModelHelper.getColor(Registry.BLOCK.getId(state.getBlock())); + SpriteIdentifier mainTexture = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PLANKS)); + SpriteIdentifier spriteIdentifier = TexturedRenderLayers.BED_TEXTURES[color.getId()]; + list.add(mainTexture.getSprite()); + list.add(spriteIdentifier.getSprite()); + } else if (state.getBlock() instanceof LogStoolBlock) { SpriteIdentifier mainTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.LOG)); SpriteIdentifier secondTexture = stripped ? new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG_TOP)) : new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.LOG_TOP)); list.add(mainTexture.getSprite()); 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 23ea2001b..c2823c202 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 @@ -9,6 +9,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.texture.MissingSprite; import net.minecraft.client.texture.Sprite; @@ -38,6 +39,16 @@ public static List getOakPlankLogSprites() { } return OAK_SPRITES_PLANKS_TO_REPLACE; } + private static final List OAK_SPRITES_BED_TO_REPLACE = new ArrayList<>(); + public static List getOakBedSprites() { + if (OAK_SPRITES_BED_TO_REPLACE.isEmpty()) { + SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.PLANKS)); + SpriteIdentifier bedId = TexturedRenderLayers.BED_TEXTURES[DyeColor.RED.getId()]; + OAK_SPRITES_BED_TO_REPLACE.add(planksId.getSprite()); + OAK_SPRITES_BED_TO_REPLACE.add(bedId.getSprite()); + } + return OAK_SPRITES_BED_TO_REPLACE; + } private static final List OAK_SPRITES_LOG_TOP_TO_REPLACE = new ArrayList<>(); public static List getOakLogLogTopSprites() { if (OAK_SPRITES_LOG_TOP_TO_REPLACE.isEmpty()) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java index 64744ac85..74d7542c4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/UnbakedBedModel.java @@ -2,7 +2,6 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; -import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -13,117 +12,89 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedBedModel implements UnbakedModel { - public static final List SIMPLE_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/simple_bed/mattresses/color_foot_mattress"); - add("block/simple_bed/mattresses/color_head_mattress"); - add("block/simple_bed/template/foot/simple_bed_foot"); - add("block/simple_bed/template/head/simple_bed_head"); - add("block/simple_bed/template/foot/simple_bed_foot_right"); - add("block/simple_bed/template/foot/simple_bed_foot_left"); - add("block/simple_bed/template/head/simple_bed_head_right"); - add("block/simple_bed/template/head/simple_bed_head_left"); - add("block/simple_bed/template/bunk/foot/simple_bed_foot_right"); - add("block/simple_bed/template/bunk/foot/simple_bed_foot_left"); - add("block/simple_bed/template/bunk/head/simple_bed_head"); - } + public static final Identifier[] BED_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/mattresses/red_foot_mattress"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/mattresses/red_head_mattress"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/foot/simple_bed_foot"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/head/simple_bed_head"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/foot/simple_bed_foot_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/foot/simple_bed_foot_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/head/simple_bed_head_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/head/simple_bed_head_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/bunk/foot/simple_bed_foot_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/bunk/foot/simple_bed_foot_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/bunk/head/simple_bed_head"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/full/simple_bed"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/mattresses/red_foot_mattress"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/mattresses/red_head_mattress"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/foot/classic_bed_foot"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/head/classic_bed_head"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/foot/classic_bed_foot_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/foot/classic_bed_foot_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/head/classic_bed_head_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/head/classic_bed_head_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/bunk/foot/classic_bed_foot_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/bunk/foot/classic_bed_foot_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed/template/bunk/head/simple_bed_head"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/classic_bed/template/full/classic_bed"), }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier BED_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/simple_bed"); public static final List BED_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ for (DyeColor dyeColor : DyeColor.values()) { - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/" + variant.asString() + "_" + dyeColor.getName() + "_simple_bed")); - } - } - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (DyeColor dyeColor : DyeColor.values()) { - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/" + variant.asString() + "_" + dyeColor.getName() + "_classic_bed")); - } - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (DyeColor dyeColor : DyeColor.values()) { - for (String part : SIMPLE_MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", variant.asString()).replace("color", dyeColor.getName()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_" + dyeColor.getName() + "_simple_bed")); } } for(WoodVariant variant : WoodVariantRegistry.getVariants()){ for (DyeColor dyeColor : DyeColor.values()) { - for (String part : SIMPLE_MODEL_PARTS_BASE) { - if (part.contains("bunk/head")) { - continue; - } - String newPart = part.replaceAll("template", variant.asString()).replace("color", dyeColor.getName()).replaceAll("simple", "classic"); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_" + dyeColor.getName() + "_classic_bed")); } } + add(BED_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - private final boolean isClassic; - public UnbakedBedModel(WoodVariant variant, DyeColor color, List modelParts, boolean isClassic) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.PLANKS)); - for(String modelPartName : SIMPLE_MODEL_PARTS_BASE){ - - String s = modelPartName.replaceAll("template", variant.asString()).replace("color", color.getName()); - if (isClassic) { - s = s.replace("simple", "classic"); - } - modelParts.add(s); - } - this.isClassic = isClassic; - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); } @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - if (isClassic && modelPart.contains("bunk/head")) { - continue; - } - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + if (CACHED_MODELS.containsKey(rotationContainer)) + return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + + List bakedModelList = new ArrayList<>(); + for (Identifier modelPart : BED_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderIDs.java b/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderIDs.java index 554ca6740..74c958be0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderIDs.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderIDs.java @@ -5,4 +5,7 @@ public class EntityRenderIDs { public static final EntityModelLayer MODEL_CUBE_LAYER = new EntityModelLayer(new Identifier("pfm", "cube"), "main"); + public static final EntityModelLayer BED_HEAD_LAYER = new EntityModelLayer(new Identifier("pfm", "bed_head"), "main"); + public static final EntityModelLayer BED_FOOT_LAYER = new EntityModelLayer(new Identifier("pfm", "bed_foot"), "main"); + } diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderRegistry.java index 8626ec717..6a25ce0e1 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/EntityRenderRegistry.java @@ -1,6 +1,7 @@ package com.unlikepaladin.pfm.client; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.blockentities.PFMBedBlockEntity; import com.unlikepaladin.pfm.entity.model.ModelEmpty; import com.unlikepaladin.pfm.entity.render.*; import com.unlikepaladin.pfm.registry.BlockEntities; @@ -22,6 +23,8 @@ public static void registerBlockEntityRenderers() { registerBlockEntityRender(BlockEntities.STOVE_BLOCK_ENTITY, getStoveBlockEntityRenderer()); registerBlockEntityRender(BlockEntities.TRASHCAN_BLOCK_ENTITY, TrashcanBlockEntityRenderer::new); registerBlockEntityRender(BlockEntities.TOASTER_BLOCK_ENTITY, PFMToasterBlockEntityRenderer::new); + registerBlockEntityRender(BlockEntities.BED_BLOCK_ENTITY, PFMBedBlockEntityRenderer::new); + PaladinFurnitureMod.pfmModCompatibilities.forEach(pfmModCompatibility -> { if (pfmModCompatibility.getClientModCompatiblity().isPresent()){ pfmModCompatibility.getClientModCompatiblity().get().registerBlockEntityRenderer(); @@ -40,6 +43,8 @@ public static void registerEntityRenderers() { public static void registerModelLayers() { registerModelLayer(EntityRenderIDs.MODEL_CUBE_LAYER, ModelEmpty.getTexturedModelData()); + registerModelLayer(EntityRenderIDs.BED_HEAD_LAYER, PFMBedBlockEntityRenderer.getHeadTexturedModelData()); + registerModelLayer(EntityRenderIDs.BED_FOOT_LAYER, PFMBedBlockEntityRenderer.getFootTexturedModelData()); } @ExpectPlatform diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/PFMBakedModelManagerAccessor.java b/common/src/main/java/com/unlikepaladin/pfm/client/PFMBakedModelManagerAccessor.java new file mode 100644 index 000000000..61077baef --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/PFMBakedModelManagerAccessor.java @@ -0,0 +1,9 @@ +package com.unlikepaladin.pfm.client; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; + +public interface PFMBakedModelManagerAccessor { + BakedModel pfm$getModelFromNormalID(Identifier id); +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/PFMBuiltinItemRendererExtension.java b/common/src/main/java/com/unlikepaladin/pfm/client/PFMBuiltinItemRendererExtension.java new file mode 100644 index 000000000..4b91ed52d --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/PFMBuiltinItemRendererExtension.java @@ -0,0 +1,5 @@ +package com.unlikepaladin.pfm.client; + +public interface PFMBuiltinItemRendererExtension { + +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/PFMItemRenderer.java b/common/src/main/java/com/unlikepaladin/pfm/client/PFMItemRenderer.java new file mode 100644 index 000000000..72b810d0c --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/PFMItemRenderer.java @@ -0,0 +1,92 @@ +package com.unlikepaladin.pfm.client; + +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.SimpleBedBlock; +import com.unlikepaladin.pfm.blocks.blockentities.PFMBedBlockEntity; +import com.unlikepaladin.pfm.blocks.models.basicLamp.UnbakedBasicLampModel; +import com.unlikepaladin.pfm.blocks.models.bed.UnbakedBedModel; +import com.unlikepaladin.pfm.data.materials.WoodVariant; +import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; +import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; +import net.minecraft.block.BedBlock; +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.block.entity.BedBlockEntity; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.RenderLayers; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher; +import net.minecraft.client.render.entity.model.EntityModelLoader; +import net.minecraft.client.render.item.BuiltinModelItemRenderer; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.util.ModelIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Arm; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; + +import java.util.*; + +public class PFMItemRenderer extends BuiltinModelItemRenderer { + private final PFMBedBlockEntity renderBed = new PFMBedBlockEntity(BlockPos.ORIGIN, PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleBedBlock.class).getVariantToBlockMapList().get(WoodVariantRegistry.OAK).iterator().next().getDefaultState()); + private final BlockEntityRenderDispatcher blockEntityRenderDispatcher; + public PFMItemRenderer(BlockEntityRenderDispatcher blockEntityRenderDispatcher, EntityModelLoader loader) { + super(blockEntityRenderDispatcher, loader); + this.blockEntityRenderDispatcher = blockEntityRenderDispatcher; + } + + static Map> bakedModels = new LinkedHashMap<>(); + static List modelParts = new ArrayList<>(); + public BakedModel getLampPartFromVariant(WoodVariant variantBase, int index) { + if (!bakedModels.isEmpty() && !modelParts.isEmpty()) { + return bakedModels.get(variantBase).get(modelParts.get(index)); + } + modelParts.clear(); + bakedModels.clear(); + modelParts.addAll(UnbakedBasicLampModel.MODEL_PARTS_BASE); + modelParts.addAll(UnbakedBasicLampModel.STATIC_PARTS); + for (WoodVariant woodVariant : WoodVariantRegistry.getVariants()) { + bakedModels.put(woodVariant, new LinkedHashMap<>()); + for (String part : modelParts) { + bakedModels.get(woodVariant).put(part, ((PFMBakedModelManagerAccessor)MinecraftClient.getInstance().getBakedModelManager()).pfm$getModelFromNormalID(new Identifier(PaladinFurnitureMod.MOD_ID, part.replaceAll("template", woodVariant.asString())))); + } + } + return bakedModels.get(variantBase).get(modelParts.get(index)); + } + + static Map bedModel = new HashMap<>(); + public BakedModel getBedModel(boolean classic) { + if (bedModel.containsKey(classic) && bedModel.get(classic) != null) { + return bedModel.get(classic); + } + bedModel.put(classic, ((PFMBakedModelManagerAccessor)MinecraftClient.getInstance().getBakedModelManager()).pfm$getModelFromNormalID(UnbakedBedModel.BED_MODEL_PARTS_BASE[classic ? 23 : 11])); + return bedModel.get(classic); + } + + @Override + public void render(ItemStack stack, ModelTransformation.Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + boolean glint = stack.hasGlint(); + + ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); + boolean leftHanded = MinecraftClient.getInstance().player != null && MinecraftClient.getInstance().player.getMainArm() == Arm.LEFT && mode.isFirstPerson(); + VertexConsumer consumer = ItemRenderer.getItemGlintConsumer(vertexConsumers, RenderLayers.getItemLayer(stack, true), true, glint); + + if (stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof SimpleBedBlock) { + matrices.push(); + + Block block = ((BlockItem) stack.getItem()).getBlock(); + BakedModel bedModel = getBedModel(stack.getItem().getTranslationKey().contains("classic")); + bedModel.getTransformation().getTransformation(mode).apply(leftHanded, matrices); + matrices.translate(-.5, -.5, -.5); // Replicate ItemRenderer's translation + + this.renderBed.setColor(((SimpleBedBlock)block).getColor()); + this.blockEntityRenderDispatcher.renderEntity(renderBed, matrices, vertexConsumers, light, overlay); + matrices.pop(); + } + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/entity/render/PFMBedBlockEntityRenderer.java b/common/src/main/java/com/unlikepaladin/pfm/entity/render/PFMBedBlockEntityRenderer.java new file mode 100644 index 000000000..fa6974a2a --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/entity/render/PFMBedBlockEntityRenderer.java @@ -0,0 +1,97 @@ +package com.unlikepaladin.pfm.entity.render; + +import com.unlikepaladin.pfm.blocks.blockentities.PFMBedBlockEntity; +import com.unlikepaladin.pfm.client.EntityRenderIDs; +import it.unimi.dsi.fastutil.ints.Int2IntFunction; +import net.minecraft.block.BedBlock; +import net.minecraft.block.BlockState; +import net.minecraft.block.ChestBlock; +import net.minecraft.block.DoubleBlockProperties; +import net.minecraft.block.entity.BedBlockEntity; +import net.minecraft.block.entity.BlockEntityType; +import net.minecraft.block.enums.BedPart; +import net.minecraft.client.model.*; +import net.minecraft.client.render.RenderLayer; +import net.minecraft.client.render.TexturedRenderLayers; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.block.entity.BedBlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRenderer; +import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; +import net.minecraft.client.render.block.entity.LightmapCoordinatesRetriever; +import net.minecraft.client.util.SpriteIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3f; +import net.minecraft.world.World; + +public class PFMBedBlockEntityRenderer implements BlockEntityRenderer { + public PFMBedBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) { + this.bedHead = ctx.getLayerModelPart(EntityRenderIDs.BED_HEAD_LAYER); + this.bedFoot = ctx.getLayerModelPart(EntityRenderIDs.BED_FOOT_LAYER); + } + private final ModelPart bedHead; + private final ModelPart bedFoot; + + public static TexturedModelData getFootTexturedModelData() { + ModelData modelData = new ModelData(); + ModelPartData modelPartData = modelData.getRoot(); + ModelPartData group = modelPartData.addChild("main", ModelPartBuilder.create(), ModelTransform.pivot(8.0F, 24.0F, -8.0F)); + + ModelPartData foot_r1 = group.addChild("foot_r1", ModelPartBuilder.create().uv(2, 24).cuboid(-8.0F, -11.0F, -8.0F, 16.0F, 13.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(-8.0F, -1.0F, 11.0F, -1.5708F, 3.1416F, 0.0F)); + return TexturedModelData.of(modelData, 64, 64); + } + + public static TexturedModelData getHeadTexturedModelData() { + ModelData modelData = new ModelData(); + ModelPartData modelPartData = modelData.getRoot(); + ModelPartData group = modelPartData.addChild("main", ModelPartBuilder.create(), ModelTransform.pivot(8.0F, 24.0F, -8.0F)); + + ModelPartData head_r1 = group.addChild("head_r1", ModelPartBuilder.create().uv(2, 2).cuboid(-28.0F, -5.0F, -3.0F, 16.0F, 13.0F, 4.0F, new Dilation(0.0F)), ModelTransform.of(-28.0F, -6.0F, 8.0F, -1.5708F, 3.1416F, 0.0F)); + + ModelPartData pillow = group.addChild("pillow", ModelPartBuilder.create(), ModelTransform.pivot(-28.0F, -5.0F, 8.0F)); + + ModelPartData head_r2 = pillow.addChild("head_r2", ModelPartBuilder.create().uv(7, 5).mirrored().cuboid(-20.0F, -5.0F, -5.0F, 7.0F, 8.0F, 1.0F, new Dilation(0.0F)).mirrored(false) + .uv(7, 5).cuboid(-27.0F, -5.0F, -5.0F, 7.0F, 8.0F, 1.0F, new Dilation(0.0F)), ModelTransform.of(0.0F, 0.0F, 0.0F, -1.5708F, 3.1416F, 0.0F)); + return TexturedModelData.of(modelData, 64, 64); + } + + @Override + public void render(PFMBedBlockEntity bedBlockEntity, float f, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, int j) { + SpriteIdentifier spriteIdentifier = TexturedRenderLayers.BED_TEXTURES[bedBlockEntity.getColor().getId()]; + World world2 = bedBlockEntity.getWorld(); + if (world2 != null) { + BlockState blockState = bedBlockEntity.getCachedState(); + DoubleBlockProperties.PropertySource propertySource = DoubleBlockProperties.toPropertySource(BlockEntityType.BED, BedBlock::getBedPart, BedBlock::getOppositePartDirection, ChestBlock.FACING, blockState, world2, bedBlockEntity.getPos(), (world, pos) -> false); + int k = ((Int2IntFunction)propertySource.apply(new LightmapCoordinatesRetriever())).get(i); + this.renderPart(matrixStack, vertexConsumerProvider, blockState.get(BedBlock.PART) == BedPart.HEAD ? this.bedHead : this.bedFoot, blockState.get(BedBlock.FACING), spriteIdentifier, k, j, false); + } else { + matrixStack.push(); + matrixStack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(270.0f)); + matrixStack.translate(0.0,0,-2.0); + this.renderPart(matrixStack, vertexConsumerProvider, this.bedHead, Direction.NORTH, spriteIdentifier, i, j, false); + matrixStack.translate(0.0,0,1.0); + this.renderPart(matrixStack, vertexConsumerProvider, this.bedFoot, Direction.NORTH, spriteIdentifier, i, j, true); + matrixStack.pop(); + } + } + + private void renderPart(MatrixStack matrix, VertexConsumerProvider vertexConsumers, ModelPart part, Direction direction, SpriteIdentifier sprite, int light, int overlay, boolean isFoot) { + matrix.push(); + matrix.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(180.0f)); + + matrix.translate(0.5, -1.5, 0); + matrix.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(direction.asRotation())); + switch (direction) { + case EAST: matrix.translate(-0.5, 0, 0); break; + case WEST: matrix.translate(0.5, 0, 0); break; + case NORTH: matrix.translate(0, 0, 0.5); break; + case SOUTH: matrix.translate(0, 0, -0.5); break; + } + + VertexConsumer vertexConsumer = sprite.getVertexConsumer(vertexConsumers, RenderLayer::getEntitySolid); + part.render(matrix, vertexConsumer, light, overlay); + matrix.pop(); + } + +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/items/DyeKit.java b/common/src/main/java/com/unlikepaladin/pfm/items/DyeKit.java index 8d6f8ce67..f33b4f833 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/items/DyeKit.java +++ b/common/src/main/java/com/unlikepaladin/pfm/items/DyeKit.java @@ -40,6 +40,7 @@ public ActionResult useOnBlock(ItemUsageContext context) { World world = context.getWorld(); BlockState blockState = world.getBlockState(blockPos); if (playerEntity.isSneaking()) { + boolean dyed = false; if(blockState.getBlock() instanceof DyeableFurnitureBlock && stack.getItem() instanceof DyeKit) { world.playSound(null, blockPos, SoundEvents.ITEM_DYE_USE, SoundCategory.BLOCKS, 1.0F, 1.0F); String newBlock= blockState.getBlock().toString(); @@ -47,15 +48,19 @@ public ActionResult useOnBlock(ItemUsageContext context) { BlockState blockState1 = Registry.BLOCK.get(new Identifier(newBlock)).getStateWithProperties(blockState); world.setBlockState(blockPos, blockState1, 3); stack.decrement(1); - return ActionResult.CONSUME; - } else if (world.getBlockEntity(blockPos) instanceof DyeableFurnitureBlockEntity && stack.getItem() instanceof DyeKit) { + dyed = true; + } + if (world.getBlockEntity(blockPos) instanceof DyeableFurnitureBlockEntity && stack.getItem() instanceof DyeKit) { world.playSound(null, blockPos, SoundEvents.ITEM_DYE_USE, SoundCategory.BLOCKS, 1.0F, 1.0F); DyeableFurnitureBlockEntity dyeableFurnitureBlockEntity = (DyeableFurnitureBlockEntity) world.getBlockEntity(blockPos); dyeableFurnitureBlockEntity.setPFMColor(getColor()); world.updateListeners(blockPos, blockState, blockState, Block.NOTIFY_ALL); - stack.decrement(1); - return ActionResult.CONSUME; + if (!dyed) + stack.decrement(1); + dyed = true; } + if (dyed) + return ActionResult.CONSUME; } return ActionResult.PASS; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMBakedModelManagerMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMBakedModelManagerMixin.java new file mode 100644 index 000000000..ebfd1be96 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMBakedModelManagerMixin.java @@ -0,0 +1,24 @@ +package com.unlikepaladin.pfm.mixin; + +import com.unlikepaladin.pfm.client.PFMBakedModelManagerAccessor; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.BakedModelManager; +import net.minecraft.client.util.ModelIdentifier; +import net.minecraft.util.Identifier; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.Map; + +@Mixin(BakedModelManager.class) +public abstract class PFMBakedModelManagerMixin implements PFMBakedModelManagerAccessor { + @Shadow + private Map models; + + @Shadow private BakedModel missingModel; + + @Override + public BakedModel pfm$getModelFromNormalID(Identifier id) { + return models.getOrDefault(id, missingModel); + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMItemRendererMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMItemRendererMixin.java new file mode 100644 index 000000000..d4f3b1c21 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMItemRendererMixin.java @@ -0,0 +1,30 @@ +package com.unlikepaladin.pfm.mixin; + +import com.unlikepaladin.pfm.client.PFMBuiltinItemRendererExtension; +import com.unlikepaladin.pfm.client.PFMItemRenderer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.json.ModelTransformation; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.item.BlockItem; +import net.minecraft.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(value = ItemRenderer.class, priority = 999) +public class PFMItemRendererMixin { + @Unique + private final PFMItemRenderer pfm$itemRenderer = new PFMItemRenderer(MinecraftClient.getInstance().getBlockEntityRenderDispatcher(), MinecraftClient.getInstance().getEntityModelLoader()); + + @Inject(at = @At("HEAD"), method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", cancellable = true) + private void renderWithItemRenderer(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) { + if (stack.getItem() instanceof PFMBuiltinItemRendererExtension || stack.getItem() instanceof BlockItem && ((BlockItem) stack.getItem()).getBlock() instanceof PFMBuiltinItemRendererExtension) { + pfm$itemRenderer.render(stack, renderMode, matrices, vertexConsumers, light, overlay); + } + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntities.java b/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntities.java index e3aaff8b7..3a0d7b2f4 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntities.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntities.java @@ -23,4 +23,5 @@ public class BlockEntities { public static BlockEntityType BATHTUB_BLOCK_ENTITY; public static BlockEntityType LAMP_BLOCK_ENTITY; public static BlockEntityType TOASTER_BLOCK_ENTITY; + public static BlockEntityType BED_BLOCK_ENTITY; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java index ce644a2de..0cd491683 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java @@ -41,6 +41,7 @@ public static void registerBlockEntities() { BlockEntities.BATHTUB_BLOCK_ENTITY = BlockEntityRegistry.registerBlockEntity("bathtub_block_entity", new Block[]{PaladinFurnitureModBlocksItems.BASIC_BATHTUB}, BathtubBlockEntity::new); BlockEntities.LAMP_BLOCK_ENTITY = BlockEntityRegistry.registerBlockEntity("lamp_block_entity", new Block[]{PaladinFurnitureModBlocksItems.BASIC_LAMP}, LampBlockEntity.getFactory()); BlockEntities.TOASTER_BLOCK_ENTITY = BlockEntityRegistry.registerBlockEntity("iron_toaster", new Block[]{PaladinFurnitureModBlocksItems.TOASTER_BLOCK}, PFMToasterBlockEntity.getFactory()); + BlockEntities.BED_BLOCK_ENTITY = BlockEntityRegistry.registerBlockEntity("bed_block_entity", PaladinFurnitureModBlocksItems.getBeds(), PFMBedBlockEntity::new); PaladinFurnitureMod.pfmModCompatibilities.forEach(PFMModCompatibility::registerBlockEntityTypes); } diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/FurnitureEntry.java b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/FurnitureEntry.java index e6d17c82f..9f9a323a6 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/FurnitureEntry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/FurnitureEntry.java @@ -7,9 +7,10 @@ import java.util.*; import java.util.function.Supplier; +import java.util.stream.IntStream; public class FurnitureEntry { - private final HashMap, List> variantToBlockMapList = new LinkedHashMap<>(); + private final HashMap, Set> variantToBlockMapList = new LinkedHashMap<>(); private final HashMap, T> variantToBlockMap = new LinkedHashMap<>(); private final HashMap, T> variantToBlockMapNonBase = new LinkedHashMap<>(); @@ -24,7 +25,7 @@ public void addBlock(VariantBase variantBase, J block1, boolea variantToBlockMapNonBase.put(variantBase, block); if (!variantToBlockMapList.containsKey(variantBase)) { - variantToBlockMapList.put(variantBase, new ArrayList<>()); + variantToBlockMapList.put(variantBase, new HashSet<>()); } variantToBlockMapList.get(variantBase).add(block); allBlocks.add(block); @@ -36,19 +37,23 @@ public void addBlock(VariantBase variantBase, J block1, boolea private Class type; public VariantBase getVariantFromEntry(Block block) { - if (block.getClass() == getTClass()) - if (variantToBlockMap.containsValue(block)) { - for (Map.Entry, T> entry: - variantToBlockMap.entrySet()) { - if (entry.getValue().equals(block)) - return entry.getKey(); - }} - else if (variantToBlockMapNonBase.containsValue(block)) { - for (Map.Entry, T> entry: - variantToBlockMapNonBase.entrySet()) { - if (entry.getValue().equals(block)) - return entry.getKey(); - }} + if (block.getClass() == getTClass()) { + for (Map.Entry, T> entry : variantToBlockMap.entrySet()) { + if (entry.getValue().equals(block)) { + return entry.getKey(); + } + } + for (Map.Entry, T> entry : variantToBlockMapNonBase.entrySet()) { + if (entry.getValue().equals(block)) { + return entry.getKey(); + } + } + for (Map.Entry, Set> entry : variantToBlockMapList.entrySet()) { + if (entry.getValue().contains(block)) { + return entry.getKey(); + } + } + } return null; } @@ -107,7 +112,7 @@ public T getFromVanillaWoodType(BoatEntity.Type woodType, boolean base){ return null; } - public HashMap, List> getVariantToBlockMapList() { + public HashMap, Set> getVariantToBlockMapList() { return variantToBlockMapList; } 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 5578b5b89..04b14cc5e 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 @@ -17,7 +17,6 @@ import com.unlikepaladin.pfm.runtime.PFMDataGenerator; import com.unlikepaladin.pfm.runtime.PFMGenerator; import com.unlikepaladin.pfm.runtime.PFMProvider; -import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.data.DataCache; @@ -180,8 +179,8 @@ public void registerNightStands() { } public void registerBeds() { - generateModelAndBlockStateForBed(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleBedBlock.class).getVariantToBlockMapList(), "simple_bed", TEMPLATE_SIMPLE_BED_ARRAY, PFMBlockStateModelGenerator::createBedBlockState, PFMBlockStateModelGenerator::createPlankBlockTexture); - generateModelAndBlockStateForBed(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicBedBlock.class).getVariantToBlockMapList(), "classic_bed", TEMPLATE_CLASSIC_BED_ARRAY, PFMBlockStateModelGenerator::createBedBlockState, PFMBlockStateModelGenerator::createPlankBlockTexture); + generateModelAndBlockStateForBed(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(SimpleBedBlock.class).getVariantToBlockMapList(), "simple_bed", PFMBlockStateModelGenerator::createBedBlockState); + generateModelAndBlockStateForBed(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicBedBlock.class).getVariantToBlockMapList(), "simple_bed", PFMBlockStateModelGenerator::createBedBlockState); } public void registerLadders() { @@ -288,6 +287,22 @@ public void generateBlockStateForBlock(Map, ? extends Block> vari }); } + public void generateModelAndBlockStateForBed(HashMap, ? extends Set> variantBaseHashMap, String blockName, BiFunction, BlockStateSupplier> stateSupplierBiFunction) { + variantBaseHashMap.forEach((variantBase, blockList) -> { + blockList.forEach(block1 -> { + Block block = (Block) block1; + if (!generatedStates.contains(Registry.BLOCK.getId(block))) { + Identifier modelID = ModelIds.getBlockModelId(block); + Identifier id = new Identifier(modelID.getNamespace(), "block/" + blockName); + List ids = new ArrayList<>(1); + ids.add(id); + this.blockStateCollector.accept(stateSupplierBiFunction.apply(block, ids)); + generatedStates.add(Registry.BLOCK.getId(block)); + }}); + }); + + } + public void generateModelAndBlockStateForVariants(Map, ? extends Block> variantBaseHashMap, String blockName, Model[] models, BiFunction, BlockStateSupplier> stateSupplierBiFunction, BiFunction, Texture> textureBiFunction) { variantBaseHashMap.forEach((variantBase, block) -> { if (!generatedStates.contains(Registry.BLOCK.getId(block))) { @@ -457,7 +472,12 @@ private static BlockStateSupplier createOrientableTableBlockState(Block block, L private static BlockStateSupplier createOrientableTableBlockState(Block block, List modelIdentifiers, int rotation) { Map variantMap = new HashMap<>(); String path = modelIdentifiers.get(0).getPath(); - Identifier id = new Identifier(modelIdentifiers.get(0).getNamespace(), path.split(path.substring(path.lastIndexOf('/')))[0] + path.substring(path.lastIndexOf('/'))); + Identifier id; + if (modelIdentifiers.size() == 1) { + id = modelIdentifiers.get(0); + } else { + id = new Identifier(modelIdentifiers.get(0).getNamespace(), path.split(path.substring(path.lastIndexOf('/')))[0] + path.substring(path.lastIndexOf('/'))); + } Integer[] rotationArray = new Integer[]{0, 90, 180, 270}; for (int i = 0; rotationArray.length > i; i++) { if (rotationArray[i] + rotation > 270) { @@ -571,9 +591,14 @@ private static BlockStateSupplier createLadderBlockState(Block block, List modelIdentifiers, String color) { + private static BlockStateSupplier createBedBlockState(Block block, List modelIdentifiers) { Map variantMap = new HashMap<>(); - Identifier id = ModelIds.getBlockModelId(block); + Identifier id; + if (modelIdentifiers.size() == 1) { + id = modelIdentifiers.get(0); + } else { + id = ModelIds.getBlockModelId(block); + } Integer[] rotationArray = new Integer[]{0, 90, 180, 270}; variantMap.put(Direction.NORTH, BlockStateVariant.create().put(VariantSettings.MODEL, id).put(VariantSettings.Y, VariantSettings.Rotation.valueOf('R'+String.valueOf(rotationArray[0])))); variantMap.put(Direction.EAST, BlockStateVariant.create().put(VariantSettings.MODEL, id).put(VariantSettings.Y, VariantSettings.Rotation.valueOf('R'+String.valueOf(rotationArray[1])))); diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java index f91e60aa9..897bc15e7 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/assets/PFMLangProvider.java @@ -236,7 +236,7 @@ public String getTranslatedVariantName(VariantBase variant) { return variantName.get(); } - public void generateTranslationForBedMap(HashMap, ? extends List> variantBaseHashMap, BufferedWriter writer, String furnitureKey, QuadFunc blockStringStringStringStringQuadFunc) { + public void generateTranslationForBedMap(HashMap, ? extends Set> variantBaseHashMap, BufferedWriter writer, String furnitureKey, QuadFunc blockStringStringStringStringQuadFunc) { variantBaseHashMap.forEach((variant, list) -> { list.forEach(block1 -> { Block block = (Block) block1; diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_foot_mattress.json deleted file mode 100644 index d8a095efd..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_head_mattress.json deleted file mode 100644 index 2a080cf3c..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/black_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_foot_mattress.json deleted file mode 100644 index 3d80b705a..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_head_mattress.json deleted file mode 100644 index 6c539dc78..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/blue_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_foot_mattress.json deleted file mode 100644 index 479a10b28..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_head_mattress.json deleted file mode 100644 index 1090c23cc..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/brown_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_foot_mattress.json deleted file mode 100644 index 3ffc2fea2..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_head_mattress.json deleted file mode 100644 index 905fd5423..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/cyan_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_foot_mattress.json deleted file mode 100644 index 48f95302c..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_head_mattress.json deleted file mode 100644 index 8b3988fc3..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/gray_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_foot_mattress.json deleted file mode 100644 index 9a7340d91..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_head_mattress.json deleted file mode 100644 index 58fbdbc74..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/green_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_foot_mattress.json deleted file mode 100644 index c64b4983f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_head_mattress.json deleted file mode 100644 index 3fcda83ac..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_blue_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_foot_mattress.json deleted file mode 100644 index 77c4220dc..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_head_mattress.json deleted file mode 100644 index 0584dc14c..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/light_gray_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_foot_mattress.json deleted file mode 100644 index 0eb3c76cf..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_head_mattress.json deleted file mode 100644 index 3a8abf5b7..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/lime_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_foot_mattress.json deleted file mode 100644 index f6223a150..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_head_mattress.json deleted file mode 100644 index 8208ce073..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/magenta_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_foot_mattress.json deleted file mode 100644 index 2976a2976..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_head_mattress.json deleted file mode 100644 index 08f29d372..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/orange_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_foot_mattress.json deleted file mode 100644 index 4e3a72418..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_head_mattress.json deleted file mode 100644 index 2717dec8e..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/pink_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_foot_mattress.json deleted file mode 100644 index b3f3e31cc..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_head_mattress.json deleted file mode 100644 index a474df02f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/purple_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/red_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/red_head_mattress.json index 04a25fdb5..99d99fb6b 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/red_head_mattress.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/red_head_mattress.json @@ -14,6 +14,27 @@ "west": {"uv": [0.5, 3.5, 1.5, 4.75], "rotation": 270, "texture": "#1"}, "up": {"uv": [1.5, 3.5, 5.5, 4.75], "texture": "#1"} } + }, + { + "from": [1, 9, 3], + "to": [15, 10, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "east": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, + "south": {"uv": [2, 3.25, 5, 3.5], "texture": "#1"}, + "west": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, + "up": {"uv": [2, 1.5, 5, 3.5], "texture": "#1"} + } + }, + { + "from": [0, 5, 3], + "to": [16, 9, 11], + "rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 8]}, + "faces": { + "east": {"uv": [1.75, 1.5, 0.5, 3.5], "rotation": 90, "texture": "#1"}, + "west": {"uv": [5.5, 3.5, 6.5, 1.5], "rotation": 90, "texture": "#1"}, + "up": {"uv": [2, 1.5, 5, 3.5], "texture": "#1"} + } } ], "display": { @@ -59,7 +80,7 @@ "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [0] + "children": [0, 1, 2] } ] } \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_foot_mattress.json deleted file mode 100644 index 5b534e4b1..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_head_mattress.json deleted file mode 100644 index d274e7bad..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/white_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_foot_mattress.json deleted file mode 100644 index 72dfcd804..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_head_mattress.json deleted file mode 100644 index 79e5998cf..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/mattresses/yellow_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_left.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_left.json index f88a25979..7efa6080a 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_left.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_left.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/classic_bed/template/bunk/foot/classic_bed_foot_right.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_right.json index 981bf28f9..db99b2514 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_right.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/bunk/foot/classic_bed_foot_right.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/classic_bed/template/foot/classic_bed_foot.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot.json index f513b275d..15e643a38 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture" + "0": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_left.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_left.json index 99b6da1b4..c0f6e7d76 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_left.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_left.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/classic_bed/template/foot/classic_bed_foot_right.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_right.json index 31ca3f253..29e4fbeb4 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_right.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/foot/classic_bed_foot_right.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/classic_bed/template/full/classic_bed.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed.json index fda73c976..0ca16ed52 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed.json @@ -1,9 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture", - "1": "entity/bed/red", - "particle": "#texture" + "0": "block/oak_planks", + "particle": "block/oak_planks" }, "elements": [ { @@ -49,34 +48,6 @@ "down": {"uv": [0, 0, 13, 16], "texture": "#0"} } }, - { - "from": [21, 5, 0], - "to": [29, 9, 16], - "faces": { - "north": {"uv": [5.5, 3.5, 6.5, 1.5], "rotation": 90, "texture": "#1"}, - "south": {"uv": [1.75, 1.5, 0.5, 3.5], "rotation": 90, "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "rotation": 90, "texture": "#1"} - } - }, - { - "from": [21, 9, 1], - "to": [29, 10, 15], - "faces": { - "north": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "south": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "west": {"uv": [2, 3.25, 5, 3.5], "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "rotation": 90, "texture": "#1"} - } - }, - { - "from": [16, 5, 0], - "to": [21, 9, 16], - "faces": { - "north": {"uv": [0.5, 3.5, 1.5, 4.75], "rotation": 270, "texture": "#1"}, - "south": {"uv": [5.5, 3.5, 6.5, 4.75], "rotation": 90, "texture": "#1"}, - "up": {"uv": [1.5, 3.5, 5.5, 4.75], "rotation": 90, "texture": "#1"} - } - }, { "from": [3, 2, 0], "to": [16, 5, 16], @@ -192,16 +163,6 @@ "down": {"uv": [0, 0, 2, 16], "texture": "#0"} } }, - { - "from": [3, 5, 0], - "to": [16, 9, 16], - "faces": { - "north": {"uv": [0.5, 7, 1.5, 11], "rotation": 270, "texture": "#1"}, - "south": {"uv": [5.5, 7, 6.5, 11], "rotation": 90, "texture": "#1"}, - "west": {"uv": [1.5, 10, 5.5, 11], "texture": "#1"}, - "up": {"uv": [1.5, 7, 5.5, 11], "texture": "#1"} - } - }, { "from": [3, 2, 0], "to": [16, 5, 16], @@ -316,16 +277,6 @@ "up": {"uv": [0, 4, 16, 6], "rotation": 90, "texture": "#0"}, "down": {"uv": [0, 0, 2, 16], "texture": "#0"} } - }, - { - "from": [3, 5, 0], - "to": [16, 9, 16], - "faces": { - "north": {"uv": [0.5, 7, 1.5, 11], "rotation": 270, "texture": "#1"}, - "south": {"uv": [5.5, 7, 6.5, 11], "rotation": 90, "texture": "#1"}, - "west": {"uv": [1.5, 10, 5.5, 11], "texture": "#1"}, - "up": {"uv": [1.5, 7, 5.5, 11], "texture": "#1"} - } } ], "display": { @@ -371,19 +322,19 @@ "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [0, 1, 2, 3, 4, 5, 6] + "children": [0, 1, 2, 3] }, { "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19] + "children": [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] }, { "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32] + "children": [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] } ] } \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_black.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_black.json deleted file mode 100644 index 3370de23f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_black.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_blue.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_blue.json deleted file mode 100644 index d02dbc926..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_blue.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_brown.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_brown.json deleted file mode 100644 index 698dab8f1..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_brown.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_cyan.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_cyan.json deleted file mode 100644 index d8854c500..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_cyan.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_gray.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_gray.json deleted file mode 100644 index 5546abd7b..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_gray.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_green.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_green.json deleted file mode 100644 index 6280cded2..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_green.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_blue.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_blue.json deleted file mode 100644 index a33329262..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_blue.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_gray.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_gray.json deleted file mode 100644 index 29a7da6a9..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_light_gray.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_lime.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_lime.json deleted file mode 100644 index 95782bd99..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_lime.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_magenta.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_magenta.json deleted file mode 100644 index c972e006f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_magenta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_orange.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_orange.json deleted file mode 100644 index 2a23639ce..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_orange.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_pink.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_pink.json deleted file mode 100644 index fe182b049..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_pink.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_purple.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_purple.json deleted file mode 100644 index e2762c2a0..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_purple.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_red.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_red.json deleted file mode 100644 index 1fe9d59c5..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_red.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/red" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_white.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_white.json deleted file mode 100644 index 35d6153f0..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_white.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_yellow.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_yellow.json deleted file mode 100644 index 4ae1810f4..000000000 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/full/classic_bed_yellow.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/classic_bed/template/full/classic_bed", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head.json index 224528bb7..4573453da 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head.json @@ -1,9 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture", - "1": "entity/bed/red", - "particle": "#texture" + "0": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_planks" }, "elements": [ { @@ -26,27 +25,6 @@ "west": {"uv": [0, 3, 13, 6], "texture": "#0"}, "down": {"uv": [0, 0, 13, 16], "rotation": 90, "texture": "#0"} } - }, - { - "from": [0, 5, 3], - "to": [16, 9, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, - "faces": { - "east": {"uv": [1.75, 1.5, 0.5, 3.5], "rotation": 90, "texture": "#1"}, - "west": {"uv": [5.5, 3.5, 6.5, 1.5], "rotation": 90, "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "texture": "#1"} - } - }, - { - "from": [1, 9, 3], - "to": [15, 10, 11], - "rotation": {"angle": 0, "axis": "y", "origin": [8, 0, 8]}, - "faces": { - "east": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "south": {"uv": [2, 3.25, 5, 3.5], "texture": "#1"}, - "west": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "texture": "#1"} - } } ], "display": { @@ -92,7 +70,7 @@ "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [0, 1, 2, 3] + "children": [0, 1] } ] } \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_left.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_left.json index 07a9f5ade..56e7a377e 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_left.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_left.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/classic_bed/template/head/classic_bed_head_right.json b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_right.json index d6cf7c479..d565357c5 100644 --- a/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_right.json +++ b/common/src/main/resources/assets/pfm/models/block/classic_bed/template/head/classic_bed_head_right.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_bed/mattresses/black_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_foot_mattress.json deleted file mode 100644 index 56095da25..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_head_mattress.json deleted file mode 100644 index 90b66bbc2..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/black_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_foot_mattress.json deleted file mode 100644 index bd9828b5c..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_head_mattress.json deleted file mode 100644 index 8b1a9d5de..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/blue_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_foot_mattress.json deleted file mode 100644 index 88795e97f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_head_mattress.json deleted file mode 100644 index c0a581e6f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/brown_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_foot_mattress.json deleted file mode 100644 index 00462e0f9..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_head_mattress.json deleted file mode 100644 index 1dd3fbba8..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/cyan_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_foot_mattress.json deleted file mode 100644 index 40063492f..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_head_mattress.json deleted file mode 100644 index ed2acf898..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/gray_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_foot_mattress.json deleted file mode 100644 index c77eda95b..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_head_mattress.json deleted file mode 100644 index 81ea481f6..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/green_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_foot_mattress.json deleted file mode 100644 index 493f2307b..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_head_mattress.json deleted file mode 100644 index ad232f41d..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_blue_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_foot_mattress.json deleted file mode 100644 index b5f60b0e3..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_head_mattress.json deleted file mode 100644 index c000436e7..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/light_gray_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_foot_mattress.json deleted file mode 100644 index 57abf9311..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_head_mattress.json deleted file mode 100644 index 374eea686..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/lime_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_foot_mattress.json deleted file mode 100644 index 160ec99c6..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_head_mattress.json deleted file mode 100644 index 43e00dedd..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/magenta_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_foot_mattress.json deleted file mode 100644 index abddccb83..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_head_mattress.json deleted file mode 100644 index d7a175077..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/orange_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_foot_mattress.json deleted file mode 100644 index f309234bb..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_head_mattress.json deleted file mode 100644 index c99f1c651..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/pink_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_foot_mattress.json deleted file mode 100644 index 4d4b5daa0..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_head_mattress.json deleted file mode 100644 index 227165294..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/purple_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_foot_mattress.json deleted file mode 100644 index 40f261441..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_head_mattress.json deleted file mode 100644 index 1e1619c12..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/white_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_foot_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_foot_mattress.json deleted file mode 100644 index 3d7a9c59c..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_foot_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_foot_mattress", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_head_mattress.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_head_mattress.json deleted file mode 100644 index 79f49dac3..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/mattresses/yellow_head_mattress.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/mattresses/red_head_mattress", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_left.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_left.json index fa51b3562..72c43f956 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_left.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_left.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture" + "0": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_right.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_right.json index 893ff1db3..8cd120694 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_right.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/foot/simple_bed_foot_right.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture" + "0": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/head/simple_bed_head.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/head/simple_bed_head.json index 9495fd0e7..cb6c596bf 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/head/simple_bed_head.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/bunk/head/simple_bed_head.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_bed/template/foot/simple_bed_foot.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot.json index 5a45df5ff..796e510fa 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture" + "0": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_left.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_left.json index 32e9ffb87..6a49f2064 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_left.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_left.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_bed/template/foot/simple_bed_foot_right.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_right.json index c7e62dbd4..f342b9fb6 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_right.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/foot/simple_bed_foot_right.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_bed/template/full/simple_bed.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed.json index 54c201d84..913298b05 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed.json @@ -1,9 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "0": "#texture", - "1": "entity/bed/red", - "particle": "#texture" + "0": "block/oak_planks", + "particle": "block/oak_planks" }, "elements": [ { @@ -49,34 +48,6 @@ "down": {"uv": [0, 0, 13, 16], "texture": "#0"} } }, - { - "from": [21, 5, 0], - "to": [29, 9, 16], - "faces": { - "north": {"uv": [5.5, 3.5, 6.5, 1.5], "rotation": 90, "texture": "#1"}, - "south": {"uv": [1.75, 1.5, 0.5, 3.5], "rotation": 90, "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "rotation": 90, "texture": "#1"} - } - }, - { - "from": [21, 9, 1], - "to": [29, 10, 15], - "faces": { - "north": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "south": {"uv": [6.5, 3.5, 6.25, 1.5], "rotation": 90, "texture": "#1"}, - "west": {"uv": [2, 3.25, 5, 3.5], "texture": "#1"}, - "up": {"uv": [2, 1.5, 5, 3.5], "rotation": 90, "texture": "#1"} - } - }, - { - "from": [16, 5, 0], - "to": [21, 9, 16], - "faces": { - "north": {"uv": [0.5, 3.875, 1.5, 5.125], "rotation": 270, "texture": "#1"}, - "south": {"uv": [5.5, 3.875, 6.5, 5.125], "rotation": 90, "texture": "#1"}, - "up": {"uv": [1.5, 3.875, 5.5, 5.125], "rotation": 90, "texture": "#1"} - } - }, { "from": [3, 2, 0], "to": [16, 5, 16], @@ -119,15 +90,6 @@ "up": {"uv": [0, 4, 16, 7], "rotation": 90, "texture": "#0"}, "down": {"uv": [0, 0, 3, 16], "texture": "#0"} } - }, - { - "from": [3, 5, 0], - "to": [16, 9, 16], - "faces": { - "north": {"uv": [0.5, 7.25, 1.5, 10.5], "rotation": 270, "texture": "#1"}, - "south": {"uv": [5.5, 7.25, 6.5, 10.5], "rotation": 90, "texture": "#1"}, - "up": {"uv": [1.5, 10.5, 5.5, 7.25], "rotation": 180, "texture": "#1"} - } } ], "display": { @@ -173,13 +135,13 @@ "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [0, 1, 2, 3, 4, 5, 6] + "children": [0, 1, 2, 3] }, { "name": "group", "origin": [0, 0, 0], "color": 0, - "children": [7, 8, 9, 10, 11] + "children": [4, 5, 6, 7] } ] } \ No newline at end of file diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_black.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_black.json deleted file mode 100644 index 43d224283..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_black.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/black" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_blue.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_blue.json deleted file mode 100644 index 1f9cbb696..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_blue.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_brown.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_brown.json deleted file mode 100644 index d961c17c8..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_brown.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/brown" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_cyan.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_cyan.json deleted file mode 100644 index 415a7403b..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_cyan.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/cyan" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_gray.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_gray.json deleted file mode 100644 index 36ccce0fc..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_gray.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_green.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_green.json deleted file mode 100644 index dc9e98a71..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_green.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/green" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_blue.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_blue.json deleted file mode 100644 index f1555d127..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_blue.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/light_blue" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_gray.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_gray.json deleted file mode 100644 index fafa831e9..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_light_gray.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/light_gray" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_lime.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_lime.json deleted file mode 100644 index 2d8d1aef8..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_lime.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/lime" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_magenta.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_magenta.json deleted file mode 100644 index efd66ecba..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_magenta.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/magenta" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_orange.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_orange.json deleted file mode 100644 index b32d8543e..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_orange.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/orange" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_pink.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_pink.json deleted file mode 100644 index cabac99f1..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_pink.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/pink" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_purple.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_purple.json deleted file mode 100644 index 08addf83a..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_purple.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/purple" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_red.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_red.json deleted file mode 100644 index 80e5f1264..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_red.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/red" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_white.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_white.json deleted file mode 100644 index 189d1d94b..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_white.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/white" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_yellow.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_yellow.json deleted file mode 100644 index d0b50cea9..000000000 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/full/simple_bed_yellow.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "credit": "By UnlikePaladin", - "parent": "pfm:block/simple_bed/template/full/simple_bed", - "textures": { - "1": "entity/bed/yellow" - } - -} diff --git a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head.json index 13e8ac86f..9f01bf646 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head.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_bed/template/head/simple_bed_head_left.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_left.json index e2a475d2a..d904cac86 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_left.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_left.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_bed/template/head/simple_bed_head_right.json b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_right.json index 71924480b..107001055 100644 --- a/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_right.json +++ b/common/src/main/resources/assets/pfm/models/block/simple_bed/template/head/simple_bed_head_right.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/pfm-common.mixins.json b/common/src/main/resources/pfm-common.mixins.json index 20e9ca290..4a3643c84 100644 --- a/common/src/main/resources/pfm-common.mixins.json +++ b/common/src/main/resources/pfm-common.mixins.json @@ -14,6 +14,8 @@ "PFMMixinDedicatedServer" ], "client": [ + "PFMBakedModelManagerMixin", + "PFMItemRendererMixin", "PFMLanguageManagerAccessor", "PFMMixinClientPacketListener", "PFMRenderLayersMixin" diff --git a/common/src/main/resources/pfm.accesswidener b/common/src/main/resources/pfm.accesswidener index 6f089e610..ddf35c6e8 100644 --- a/common/src/main/resources/pfm.accesswidener +++ b/common/src/main/resources/pfm.accesswidener @@ -7,4 +7,5 @@ accessible method net/minecraft/world/poi/PointOfInterestType setup (Lnet/minecr mutable field net/minecraft/world/poi/PointOfInterestType HOME Lnet/minecraft/world/poi/PointOfInterestType; accessible method net/minecraft/data/server/BlockLootTableGenerator drops (Lnet/minecraft/item/ItemConvertible;)Lnet/minecraft/loot/LootTable$Builder; accessible method net/minecraft/data/server/BlockLootTableGenerator dropsWithProperty (Lnet/minecraft/block/Block;Lnet/minecraft/state/property/Property;Ljava/lang/Comparable;)Lnet/minecraft/loot/LootTable$Builder; -accessible class net/minecraft/data/server/AbstractTagProvider$ObjectBuilder \ No newline at end of file +accessible class net/minecraft/data/server/AbstractTagProvider$ObjectBuilder +accessible method net/minecraft/client/render/item/ItemRenderer renderBakedItemModel (Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/item/ItemStack;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;)V \ No newline at end of file diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java index 4f4669fbe..f7de2e862 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/FabricBedModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.ClassicBedBlock; import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.bed.BedInterface; import com.unlikepaladin.pfm.blocks.models.fabric.PFMFabricBakedModel; import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; @@ -10,6 +11,7 @@ import net.minecraft.block.BedBlock; import net.minecraft.block.BlockState; import net.minecraft.block.enums.BedPart; +import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; @@ -24,10 +26,8 @@ import java.util.function.Supplier; public class FabricBedModel extends PFMFabricBakedModel implements BedInterface { - private final List modelParts; - public FabricBedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public FabricBedModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @Override @@ -43,40 +43,48 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos boolean left = isBed(blockView, pos, dir.rotateYCounterclockwise(), dir, state, isClassic); boolean right = isBed(blockView, pos, dir.rotateYClockwise(), dir, state, isClassic); boolean bunk = isBed(blockView, pos, Direction.DOWN, dir, state, isClassic); + int classicOffset = isClassic ? 12 : 0; BedPart part = state.get(BedBlock.PART); + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakBedSprites(), spriteList); if (part == BedPart.HEAD) { - ((FabricBakedModel) getTemplateBakedModels().get((1))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel) getTemplateBakedModels().get((3))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+3))).emitBlockQuads(blockView, state, pos, randomSupplier, context); if (!right){ - ((FabricBakedModel) getTemplateBakedModels().get((6))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+6))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left){ - ((FabricBakedModel) getTemplateBakedModels().get((7))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+7))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - ((FabricBakedModel) getTemplateBakedModels().get((10))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+10))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } } else { - ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel) getTemplateBakedModels().get((2))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+2))).emitBlockQuads(blockView, state, pos, randomSupplier, context); if (!right){ - ((FabricBakedModel) getTemplateBakedModels().get((4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left){ - ((FabricBakedModel) getTemplateBakedModels().get((5))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+5))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!right && bunk){ - ((FabricBakedModel) getTemplateBakedModels().get((8))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+8))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } if (!left && bunk){ - ((FabricBakedModel) getTemplateBakedModels().get((9))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+9))).emitBlockQuads(blockView, state, pos, randomSupplier, context); } } + context.popTransform(); } } + @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakBedSprites(), spriteList); + int classicOffset = stack.getTranslationKey().contains("classic") ? 12 : 0; + ((FabricBakedModel) getTemplateBakedModels().get((classicOffset+11))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java index e7437e57b..95dae06bb 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/fabric/UnbakedBedModelImpl.java @@ -2,14 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedBedModelImpl { - - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricBedModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricBedModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java index bb3cc90f7..70bbf2f1c 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java @@ -34,10 +34,12 @@ public void pushTextureTransform(RenderContext context, Sprite sprite) { return true; }); } - public void pushTextureTransform(RenderContext context, List toReplace, List replacement) { + pushTextureTransform(context, toReplace, replacement, PlayerScreenHandler.BLOCK_ATLAS_TEXTURE); + } + public void pushTextureTransform(RenderContext context, List toReplace, List replacement, Identifier atlasId) { context.pushTransform(quad -> { - Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE)).find(quad, 0); + Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(atlasId)).find(quad, 0); Identifier keyId = originalSprite.getId(); int textureIndex = IntStream.range(0, toReplace.size()) .filter(i -> keyId.equals(toReplace.get(i).getId())) diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/EntityRenderRegistryFabric.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/EntityRenderRegistryFabric.java index 53124cf2b..627ee57a2 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/EntityRenderRegistryFabric.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/EntityRenderRegistryFabric.java @@ -1,16 +1,6 @@ package com.unlikepaladin.pfm.client.fabric; import com.unlikepaladin.pfm.client.EntityRenderRegistry; -import com.unlikepaladin.pfm.entity.model.ModelEmpty; -import com.unlikepaladin.pfm.entity.render.*; -import com.unlikepaladin.pfm.registry.BlockEntities; -import com.unlikepaladin.pfm.registry.Entities; -import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry; -import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; - -import static com.unlikepaladin.pfm.client.EntityRenderIDs.MODEL_CUBE_LAYER; - public class EntityRenderRegistryFabric { public static void registerRender() { 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 fa9cc54f8..b1bb13ef8 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 @@ -35,7 +35,9 @@ public class PFMExtraModelProvider implements ExtraModelProvider { @Override public void provideExtraModels(ResourceManager manager, Consumer out) { - UnbakedBedModel.ALL_MODEL_IDS.forEach(out::accept); + for (Identifier id : UnbakedBedModel.BED_MODEL_PARTS_BASE) { + out.accept(id); + } for (Identifier id : UnbakedBasicTableModel.BASIC_MODEL_PARTS_BASE) { out.accept(id); } 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 7bdb0624b..781589c7e 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 @@ -40,8 +40,8 @@ public class PFMModelProvider implements ModelResourceProvider { public @Nullable UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) { if (ModelHelper.containsIdentifier(UnbakedMirrorModel.MIRROR_MODEL_IDS, resourceId)){ return new UnbakedMirrorModel(UnbakedMirrorModel.DEFAULT_TEXTURES[2], ModelHelper.getVanillaConcreteColor(resourceId), UnbakedMirrorModel.DEFAULT_TEXTURES[1], new ArrayList<>(), ModelHelper.getColor(resourceId)); - } else if (ModelHelper.containsIdentifier(UnbakedBedModel.BED_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedBedModel(ModelHelper.getWoodType(resourceId), ModelHelper.getColor(resourceId), new ArrayList<>(), resourceId.getPath().contains("classic")); + } else if (UnbakedBedModel.BED_MODEL_IDS.contains(resourceId)){ + return new UnbakedBedModel(); } else if (UnbakedBasicTableModel.MODEL_IDS.contains(resourceId)){ return new UnbakedBasicTableModel(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java index 54cd71124..cf95c844c 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/ForgeBedModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.ClassicBedBlock; import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.bed.BedInterface; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; @@ -13,6 +14,7 @@ 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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -25,13 +27,16 @@ import java.util.*; public class ForgeBedModel extends PFMForgeBakedModel implements BedInterface { - public ForgeBedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public ForgeBedModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; public static ModelProperty CONNECTIONS = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + } @NotNull @Override @@ -43,44 +48,57 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean left = data.get(0); boolean right = data.get(1); boolean bunk = data.get(2); + boolean isClassic = state.getBlock().getTranslationKey().contains("classic"); + int classicOffset = isClassic ? 12 : 0; if (part == BedPart.HEAD) { - quads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); - quads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+3).getQuads(state, side, rand, extraData)); if (!right){ - quads.addAll(getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+6).getQuads(state, side, rand, extraData)); } if (!left){ - quads.addAll(getTemplateBakedModels().get(7).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+7).getQuads(state, side, rand, extraData)); } - if (bunk && !(state.getBlock() instanceof ClassicBedBlock)){ - quads.addAll(getTemplateBakedModels().get(10).getQuads(state, side, rand, extraData)); + if (bunk && !isClassic){ + quads.addAll(getTemplateBakedModels().get(classicOffset+10).getQuads(state, side, rand, extraData)); } } else { - quads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); - quads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+2).getQuads(state, side, rand, extraData)); if (!right){ - quads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+4).getQuads(state, side, rand, extraData)); } if (!left){ - quads.addAll(getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+5).getQuads(state, side, rand, extraData)); } if (!right && bunk){ - quads.addAll(getTemplateBakedModels().get(8).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+8).getQuads(state, side, rand, extraData)); } if (!left && bunk){ - quads.addAll(getTemplateBakedModels().get(9).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(classicOffset+9).getQuads(state, side, rand, extraData)); } } + List spriteList = getSpriteList(state); + return getQuadsWithTexture(quads, ModelHelper.getOakBedSprites(), spriteList); } - return quads; + return Collections.emptyList(); } + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + int classicOffset = stack.getTranslationKey().contains("classic") ? 12 : 0; + List spriteList = getSpriteList(stack); + return getQuadsWithTexture((getTemplateBakedModels().get((classicOffset+11))).getQuads(state, face, random), ModelHelper.getOakBedSprites(), spriteList); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView blockView, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof SimpleBedBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(blockView, pos, state, data); + Direction dir = state.get(BedBlock.FACING); boolean isClassic = state.getBlock().getTranslationKey().contains("classic"); boolean left = isBed(blockView, pos, dir.rotateYCounterclockwise(), dir, state, isClassic); @@ -90,8 +108,9 @@ public IModelData getModelData(@NotNull BlockRenderView blockView, @NotNull Bloc set.set(0, left); set.set(1, right); set.set(2, bunk); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java index 1138b3335..b08c211e8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/bed/forge/UnbakedBedModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedBedModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeBedModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeBedModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index 19eceb2d4..07a9190f8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -83,7 +83,7 @@ public List getQuadsWithTexture(List quads, List t return transformedQuads; } - Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); + Map, BakedQuad> quadToTransformedQuad = new ConcurrentHashMap<>(); public List getQuadsWithTexture(List quads, Sprite sprite) { List transformedQuads = new ArrayList<>(quads.size()); @@ -91,8 +91,8 @@ public List getQuadsWithTexture(List quads, Sprite sprite) int uvVertexIndx = findVertexElement(VertexFormatElement.Type.UV, 0); quads.forEach(quad -> { - Pair quadKey = new Pair<>(sprite, quad); - if (quad.getSprite() == sprite && !quadToTransformedQuad.containsKey(quadKey)) { + Pair quadKey = new Pair<>(sprite.getId(), quad); + if (quad.getSprite().getId() == sprite.getId() && !quadToTransformedQuad.containsKey(quadKey)) { quadToTransformedQuad.put(quadKey, quad); transformedQuads.add(quad); } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java index 50f1939c4..426e68b14 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMItemRenderer.java @@ -29,7 +29,6 @@ import java.util.List; import java.util.Map; -@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = PaladinFurnitureMod.MOD_ID, value = Dist.CLIENT) public class PFMItemRenderer extends BuiltinModelItemRenderer { public static final PFMItemRenderer INSTANCE = new PFMItemRenderer(); public PFMItemRenderer() { 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 c14510754..f24879a15 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 @@ -76,8 +76,9 @@ public static KeyBinding registerKey(String name, String category, int keyCode) @SubscribeEvent public static void registerExtraModels(ModelRegistryEvent event) { - - UnbakedBedModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); + for (Identifier id : UnbakedBedModel.BED_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } for (Identifier id : UnbakedBasicTableModel.BASIC_MODEL_PARTS_BASE) { ModelLoader.addSpecialModel(id); } 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 5a94ccd3e..d80e313fb 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 @@ -62,8 +62,8 @@ public abstract class PFMModelLoaderMixin { this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); - } else if (ModelHelper.containsIdentifier(UnbakedBedModel.BED_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedBedModel(ModelHelper.getWoodType(resourceId), ModelHelper.getColor(resourceId), new ArrayList<>(), resourceId.getPath().contains("classic")); + } else if (UnbakedBedModel.BED_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedBedModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); From 52fc69b6e8462671f6c09b6b09f9f0f567137f87 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 23 Dec 2023 01:23:40 -0600 Subject: [PATCH 05/10] migrated counters, kitchen and non kitchen cabinets, drawers, oven and sink to the new model system also fixed some issues with counter recipe materials not being consistent with the visuals --- .../pfm/blocks/models/AbstractBakedModel.java | 14 +++ .../UnbakedKitchenCabinetModel.java | 103 +++++----------- .../UnbakedKitchenCounterModel.java | 100 +++++----------- .../UnbakedKitchenCounterOvenModel.java | 95 +++++---------- .../UnbakedKitchenDrawerModel.java | 111 ++++++------------ .../kitchenSink/UnbakedKitchenSinkModel.java | 80 +++++++++++++ .../UnbakedKitchenWallCounterModel.java | 95 ++++----------- .../UnbakedKitchenWallDrawerModel.java | 103 +++++----------- .../UnbakedKitchenWallDrawerSmallModel.java | 81 +++++++++++++ .../assets/PFMBlockstateModelProvider.java | 39 +++--- .../pfm/runtime/data/PFMRecipeProvider.java | 2 +- .../kitchen_cabinet/kitchen_cabinet.json | 6 +- .../kitchen_cabinet_edge_left.json | 6 +- .../kitchen_cabinet_edge_left_open.json | 6 +- .../kitchen_cabinet_edge_right.json | 6 +- .../kitchen_cabinet_edge_right_open.json | 6 +- .../kitchen_cabinet_inner_corner_left.json | 6 +- ...itchen_cabinet_inner_corner_open_left.json | 6 +- ...tchen_cabinet_inner_corner_open_right.json | 6 +- .../kitchen_cabinet_inner_corner_right.json | 6 +- .../kitchen_cabinet/kitchen_cabinet_open.json | 6 +- .../kitchen_cabinet_outer_corner_left.json | 6 +- ...itchen_cabinet_outer_corner_open_left.json | 6 +- ...tchen_cabinet_outer_corner_open_right.json | 6 +- .../kitchen_cabinet_outer_corner_right.json | 6 +- .../kitchen_counter/kitchen_counter.json | 6 +- .../kitchen_counter_bottom.json | 4 +- .../kitchen_counter_bottom_inner_corner.json | 4 +- .../kitchen_counter_bottom_outer_corner.json | 4 +- .../kitchen_counter_edge_left.json | 6 +- .../kitchen_counter_edge_right.json | 6 +- .../kitchen_counter_inner_corner_left.json | 6 +- .../kitchen_counter_inner_corner_right.json | 6 +- .../kitchen_counter_middle.json | 4 +- ...chen_counter_middle_inner_corner_left.json | 4 +- ...hen_counter_middle_inner_corner_right.json | 4 +- ...chen_counter_middle_outer_corner_left.json | 4 +- ...hen_counter_middle_outer_corner_right.json | 4 +- .../kitchen_counter_outer_corner_left.json | 6 +- .../kitchen_counter_outer_corner_right.json | 6 +- .../kitchen_counter_oven.json | 6 +- .../kitchen_counter_oven_middle.json | 4 +- .../kitchen_counter_oven_middle_open.json | 4 +- .../kitchen_counter_oven_open.json | 6 +- .../block/kitchen_drawer/kitchen_drawer.json | 6 +- .../kitchen_drawer/kitchen_drawer_bottom.json | 6 +- .../kitchen_drawer_bottom_inner_corner.json | 6 +- .../kitchen_drawer_bottom_open.json | 6 +- .../kitchen_drawer_bottom_outer_corner.json | 6 +- ...n_drawer_bottom_outer_corner_mirrored.json | 6 +- ...tchen_drawer_bottom_outer_corner_open.json | 6 +- .../kitchen_drawer_edge_left.json | 6 +- .../kitchen_drawer_edge_left_open.json | 6 +- .../kitchen_drawer_edge_right.json | 6 +- .../kitchen_drawer_edge_right_open.json | 6 +- .../kitchen_drawer_inner_corner_left.json | 6 +- .../kitchen_drawer_inner_corner_right.json | 6 +- .../kitchen_drawer/kitchen_drawer_middle.json | 6 +- ...tchen_drawer_middle_inner_corner_left.json | 6 +- ...chen_drawer_middle_inner_corner_right.json | 6 +- .../kitchen_drawer_middle_open.json | 6 +- ...tchen_drawer_middle_outer_corner_left.json | 6 +- ..._drawer_middle_outer_corner_open_left.json | 6 +- ...drawer_middle_outer_corner_open_right.json | 6 +- ...chen_drawer_middle_outer_corner_right.json | 6 +- .../kitchen_drawer/kitchen_drawer_open.json | 6 +- .../kitchen_drawer_outer_corner_left.json | 6 +- ...kitchen_drawer_outer_corner_open_left.json | 6 +- ...itchen_drawer_outer_corner_open_right.json | 6 +- .../kitchen_drawer_outer_corner_right.json | 6 +- .../block/kitchen_sink/kitchen_sink.json | 6 +- .../block/kitchen_sink/kitchen_sink_full.json | 6 +- .../kitchen_sink/kitchen_sink_level1.json | 6 +- .../kitchen_sink/kitchen_sink_level2.json | 6 +- .../kitchen_wall_drawer_small.json | 6 +- .../kitchen_wall_drawer_small_open.json | 6 +- .../fabric/FabricKitchenCabinetModel.java | 13 +- .../UnbakedKitchenCabinetModelImpl.java | 11 +- .../fabric/FabricKitchenCounterModel.java | 13 +- .../UnbakedKitchenCounterModelImpl.java | 10 +- .../fabric/FabricKitchenCounterOvenModel.java | 15 ++- .../UnbakedKitchenCounterOvenModelImpl.java | 11 +- .../fabric/FabricKitchenDrawerModel.java | 19 ++- .../fabric/UnbakedKitchenDrawerModelImpl.java | 11 +- .../fabric/FabricKitchenSinkModel.java | 54 +++++++++ .../fabric/UnbakedKitchenSinkModelImpl.java | 19 +++ .../fabric/FabricKitchenWallCounterModel.java | 16 ++- .../UnbakedKitchenWallCounterModelImpl.java | 11 +- .../fabric/FabricKitchenWallDrawerModel.java | 17 ++- .../UnbakedKitchenWallDrawerModelImpl.java | 11 +- .../FabricKitchenWallDrawerSmallModel.java | 54 +++++++++ ...nbakedKitchenWallDrawerSmallModelImpl.java | 19 +++ .../client/fabric/PFMExtraModelProvider.java | 32 ++++- .../pfm/client/fabric/PFMModelProvider.java | 40 ++++--- .../forge/ForgeKitchenCabinetModel.java | 47 ++++++-- .../forge/UnbakedKitchenCabinetModelImpl.java | 11 +- .../forge/ForgeKitchenCounterModel.java | 47 ++++++-- .../forge/UnbakedKitchenCounterModelImpl.java | 11 +- .../forge/ForgeKitchenCounterOvenModel.java | 37 ++++-- .../UnbakedKitchenCounterOvenModelImpl.java | 11 +- .../forge/ForgeKitchenDrawerModel.java | 51 +++++--- .../forge/UnbakedKitchenDrawerModelImpl.java | 11 +- .../forge/ForgeKitchenSinkModel.java | 67 +++++++++++ .../forge/UnbakedKitchenSinkModelImpl.java | 19 +++ .../forge/ForgeKitchenWallCounterModel.java | 51 +++++--- .../UnbakedKitchenWallCounterModelImpl.java | 11 +- .../forge/ForgeKitchenWallDrawerModel.java | 51 +++++--- .../UnbakedKitchenWallDrawerModelImpl.java | 11 +- .../ForgeKitchenWallDrawerSmallModel.java | 71 +++++++++++ ...nbakedKitchenWallDrawerSmallModelImpl.java | 19 +++ .../forge/PaladinFurnitureModClientForge.java | 32 ++++- .../pfm/mixin/forge/PFMModelLoaderMixin.java | 38 ++++-- 112 files changed, 1356 insertions(+), 809 deletions(-) create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java create mode 100644 common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/FabricKitchenSinkModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/FabricKitchenWallDrawerSmallModel.java create mode 100644 fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/ForgeKitchenSinkModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/ForgeKitchenWallDrawerSmallModel.java create mode 100644 forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java index 5ca96bbe0..9b63069aa 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/AbstractBakedModel.java @@ -1,13 +1,18 @@ package com.unlikepaladin.pfm.blocks.models; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.LogStoolBlock; import com.unlikepaladin.pfm.blocks.SimpleBedBlock; import com.unlikepaladin.pfm.data.materials.BlockType; +import com.unlikepaladin.pfm.data.materials.StoneVariant; import com.unlikepaladin.pfm.data.materials.VariantBase; +import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; +import com.unlikepaladin.pfm.runtime.data.PFMRecipeProvider; import net.minecraft.block.Block; import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.block.entity.BedBlockEntity; import net.minecraft.client.render.TexturedRenderLayers; import net.minecraft.client.render.model.BakedModel; @@ -21,6 +26,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.DyeColor; +import net.minecraft.util.Pair; import net.minecraft.util.math.Direction; import net.minecraft.util.registry.Registry; import org.jetbrains.annotations.Nullable; @@ -161,6 +167,14 @@ private List getSpriteFromState(BlockState state) { list.add(mainTexture.getSprite()); list.add(mainTexture.getSprite()); } + boolean isKitchen = state.getBlock().getTranslationKey().contains("kitchen_"); + if (isKitchen && !(variant instanceof WoodVariant)) { + Pair counterMaterials = PFMRecipeProvider.getCounterMaterials(variant); + SpriteIdentifier mainTexture = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(counterMaterials.getLeft())); + SpriteIdentifier secondTexture = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, ModelHelper.getTextureId(counterMaterials.getRight())); + list.set(0, mainTexture.getSprite()); + list.set(1, secondTexture.getSprite()); + } spriteList.put(state.getBlock(), list); return list; } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java index ead9c97a7..6f082be16 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/UnbakedKitchenCabinetModel.java @@ -16,90 +16,45 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedKitchenCabinetModel implements UnbakedModel { - public static final List CABINET_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_inner_corner_left"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_inner_corner_right"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_outer_corner_left"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_outer_corner_right"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_open"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_inner_corner_open_left"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_inner_corner_open_right"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_outer_corner_open_left"); - add("block/kitchen_cabinet/template_kitchen_cabinet/template_kitchen_cabinet_outer_corner_open_right"); - } + public static final Identifier[] CABINET_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_outer_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_outer_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_right") }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier CABINET_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet"); public static final List CABINET_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/" + variant.asString() + "_kitchen_cabinet")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/stripped_" + variant.asString() + "_kitchen_cabinet")); - } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/" + variant.asString() + "_kitchen_cabinet")); - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_cabinet/" + variant.asString() + "_kitchen_cabinet")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : CABINET_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_cabinet")); if (variant.hasStripped()) - for (String part : CABINET_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_cabinet")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - for (String part : CABINET_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_cabinet")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : CABINET_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_cabinet")); } + add(CABINET_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenCabinetModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : CABINET_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -107,24 +62,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : CABINET_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java index aaeb12756..7f4942a0d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/UnbakedKitchenCounterModel.java @@ -16,87 +16,43 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; -// throw new RuntimeException("Method wasn't replaced correctly"); + @Environment(EnvType.CLIENT) public class UnbakedKitchenCounterModel implements UnbakedModel { - public static final List COUNTER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_edge_left"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_edge_right"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_inner_corner_left"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_inner_corner_right"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_outer_corner_left"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_outer_corner_right"); - } + public static final Identifier[] COUNTER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_edge_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_edge_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_outer_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_outer_corner_right") }; + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier COUNTER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter"); public static final List COUNTER_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/" + variant.asString() + "_kitchen_counter")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/stripped_" + variant.asString() + "_kitchen_counter")); - } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/" + variant.asString() + "_kitchen_counter")); - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/" + variant.asString() + "_kitchen_counter")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter")); if (variant.hasStripped()) - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_counter")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter")); } + add(COUNTER_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenCounterModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : COUNTER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -104,24 +60,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : COUNTER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java index 577373614..9f7d06f3d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/UnbakedKitchenCounterOvenModel.java @@ -1,5 +1,6 @@ package com.unlikepaladin.pfm.blocks.models.kitchenCounterOven; +import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.data.materials.*; import dev.architectury.injectables.annotations.ExpectPlatform; @@ -16,110 +17,68 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedKitchenCounterOvenModel implements UnbakedModel { - public static final List OVEN_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_counter_oven/template_kitchen_counter_oven/template_kitchen_counter_oven"); - add("block/kitchen_counter_oven/template_kitchen_counter_oven/template_kitchen_counter_oven_middle"); - add("block/kitchen_counter_oven/template_kitchen_counter_oven/template_kitchen_counter_oven_open"); - add("block/kitchen_counter_oven/template_kitchen_counter_oven/template_kitchen_counter_oven_middle_open"); - } + public static final Identifier[] OVEN_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/kitchen_counter_oven"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/kitchen_counter_oven_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/kitchen_counter_oven_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/kitchen_counter_oven_middle_open") }; - private static final Identifier PARENT = new Identifier("block/block"); + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier OVEN_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven"); public static final List OVEN_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/" + variant.asString() + "_kitchen_counter_oven")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter_oven")); if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/stripped_" + variant.asString() + "_kitchen_counter_oven")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_counter_oven")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/" + variant.asString() + "_kitchen_counter_oven")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter_oven")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter_oven/" + variant.asString() + "_kitchen_counter_oven")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_counter_oven")); } + add(OVEN_MODEL_ID); } }; - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : OVEN_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) - for (String part : OVEN_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - for (String part : OVEN_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : OVEN_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - } - }; - - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenCounterOvenModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : OVEN_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); } @Override - public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + 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) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : OVEN_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java index 51c2e4dde..f73fdbf48 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/UnbakedKitchenDrawerModel.java @@ -16,94 +16,49 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedKitchenDrawerModel implements UnbakedModel { - public static final List COUNTER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_edge_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_edge_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_inner_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_inner_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_outer_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_outer_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_open"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_edge_left_open"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_edge_right_open"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_inner_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_inner_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_outer_corner_open_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_outer_corner_open_right"); - } + public static final Identifier[] COUNTER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_edge_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_edge_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_outer_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_outer_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_edge_left_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_edge_right_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_outer_corner_open_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_outer_corner_open_right") }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier DRAWER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer"); public static final List DRAWER_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/" + variant.asString() + "_kitchen_drawer")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/stripped_" + variant.asString() + "_kitchen_drawer")); - } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/" + variant.asString() + "_kitchen_drawer")); - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/" + variant.asString() + "_kitchen_drawer")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_drawer")); if (variant.hasStripped()) - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_drawer")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_drawer")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_drawer")); } + add(DRAWER_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenDrawerModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : COUNTER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -111,24 +66,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : COUNTER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java new file mode 100644 index 000000000..59adc8ff7 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/UnbakedKitchenSinkModel.java @@ -0,0 +1,80 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenSink; + +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.*; +import dev.architectury.injectables.annotations.ExpectPlatform; +import net.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +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; + +@Environment(EnvType.CLIENT) +public class UnbakedKitchenSinkModel implements UnbakedModel { + public static final Identifier[] SINK_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_sink/kitchen_sink"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_sink/kitchen_sink_level1"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_sink/kitchen_sink_level2"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_sink/kitchen_sink_full"), + }; + + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier SINK_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_sink"); + public static final List SINK_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_sink")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_sink")); + } + for(StoneVariant variant : StoneVariant.values()){ + if (variant.equals(StoneVariant.QUARTZ)) + continue; + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_sink")); + } + for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_sink")); + } + add(SINK_MODEL_ID); + } + }; + + @Override + 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 : SINK_MODEL_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"); + } +} \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java index 434ee5e2f..b5e7d1b06 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/UnbakedKitchenWallCounterModel.java @@ -10,92 +10,45 @@ import net.minecraft.client.render.model.ModelLoader; import net.minecraft.client.render.model.UnbakedModel; import net.minecraft.client.texture.Sprite; -import net.minecraft.client.texture.SpriteAtlasTexture; 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; @Environment(EnvType.CLIENT) public class UnbakedKitchenWallCounterModel implements UnbakedModel { - public static final List COUNTER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_middle"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_middle_inner_corner_left"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_middle_inner_corner_right"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_middle_outer_corner_left"); - add("block/kitchen_counter/template_kitchen_counter/template_kitchen_counter_middle_outer_corner_right"); - } + public static final Identifier[] COUNTER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_middle_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_middle_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_middle_outer_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_counter/kitchen_counter_middle_outer_corner_right") }; private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier COUNTER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter"); public static final List COUNTER_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/" + variant.asString() + "_kitchen_wall_counter")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_counter")); if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/stripped_" + variant.asString() + "_kitchen_wall_counter")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_counter")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/" + variant.asString() + "_kitchen_wall_counter")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_counter")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_counter/" + variant.asString() + "_kitchen_wall_counter")); + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_counter")); } + add(COUNTER_MODEL_ID); } }; - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - if (variant.hasStripped()) - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } - } - } - }; - - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenWallCounterModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : COUNTER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -103,24 +56,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : COUNTER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java index 83a21d7a9..0c94bf51f 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/UnbakedKitchenWallDrawerModel.java @@ -16,89 +16,46 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; @Environment(EnvType.CLIENT) public class UnbakedKitchenWallDrawerModel implements UnbakedModel { - public static final List COUNTER_MODEL_PARTS_BASE = new ArrayList<>() { - { - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_inner_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_inner_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_outer_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_outer_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_open"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_inner_corner_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_inner_corner_right"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_outer_corner_open_left"); - add("block/kitchen_drawer/template_kitchen_drawer/template_kitchen_drawer_middle_outer_corner_open_right"); - } + public static final Identifier[] COUNTER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_outer_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_outer_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_open"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_left"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_right") }; + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier DRAWER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer"); public static final List DRAWER_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/" + variant.asString() + "_kitchen_wall_drawer")); - if (variant.hasStripped()) - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/stripped_" + variant.asString() + "_kitchen_wall_drawer")); - } - for(StoneVariant variant : StoneVariant.values()){ - if (variant.equals(StoneVariant.QUARTZ)) - continue; - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/" + variant.asString() + "_kitchen_wall_drawer")); - } - for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - add(new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer/" + variant.asString() + "_kitchen_wall_drawer")); - } - } - }; - - public static final List ALL_MODEL_IDS = new ArrayList<>() { - { - for(WoodVariant variant : WoodVariantRegistry.getVariants()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_drawer")); if (variant.hasStripped()) - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", "stripped_" + variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_drawer")); } for(StoneVariant variant : StoneVariant.values()){ if (variant.equals(StoneVariant.QUARTZ)) continue; - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_drawer")); } for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ - for (String part : COUNTER_MODEL_PARTS_BASE) { - String newPart = part.replace("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_drawer")); } + add(DRAWER_MODEL_ID); } }; - protected final SpriteIdentifier frameTex; - private final List MODEL_PARTS; - - public UnbakedKitchenWallDrawerModel(VariantBase variant, List modelParts, BlockType type) { - this.frameTex = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(type)); - for(String modelPartName : COUNTER_MODEL_PARTS_BASE){ - String s = modelPartName.replace("template", variant.asString()); - if (type == BlockType.STRIPPED_LOG) { - s = s.replace(variant.asString(), "stripped_" + variant.asString()); - } - modelParts.add(s); - } - this.MODEL_PARTS = modelParts; - } - @Override public Collection getModelDependencies() { return List.of(PARENT); @@ -106,24 +63,26 @@ public Collection getModelDependencies() { @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - List list = new ArrayList<>(2); - list.add(frameTex); - return list; + return Collections.emptyList(); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override - public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings - rotationContainer, Identifier modelId) { - Map bakedModels = new LinkedHashMap<>(); - for (String modelPart : MODEL_PARTS) { - bakedModels.put(modelPart, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, modelPart), rotationContainer)); + 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 : COUNTER_MODEL_PARTS_BASE) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(textureGetter.apply(frameTex), rotationContainer, bakedModels, MODEL_PARTS); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { throw new RuntimeException("Method wasn't replaced correctly"); } } \ No newline at end of file diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java new file mode 100644 index 000000000..2fc3ea970 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/UnbakedKitchenWallDrawerSmallModel.java @@ -0,0 +1,81 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall; + +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.data.materials.ExtraCounterVariant; +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.fabricmc.api.EnvType; +import net.fabricmc.api.Environment; +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; + +@Environment(EnvType.CLIENT) +public class UnbakedKitchenWallDrawerSmallModel implements UnbakedModel { + public static final Identifier[] DRAWER_MODEL_PARTS_BASE = new Identifier[] { + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer_small/kitchen_wall_drawer_small"), + new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_drawer_small/kitchen_wall_drawer_small_open") + }; + + private static final Identifier PARENT = new Identifier("block/block"); + public static final Identifier DRAWER_MODEL_ID = new Identifier(PaladinFurnitureMod.MOD_ID, "block/kitchen_wall_small_drawer"); + public static final List DRAWER_MODEL_IDS = new ArrayList<>() { + { + for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_small_drawer")); + if (variant.hasStripped()) + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/stripped_" + variant.asString() + "_kitchen_wall_small_drawer")); + } + for(StoneVariant variant : StoneVariant.values()){ + if (variant.equals(StoneVariant.QUARTZ)) + continue; + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_small_drawer")); + } + for(ExtraCounterVariant variant : ExtraCounterVariant.values()){ + add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_kitchen_wall_small_drawer")); + } + add(DRAWER_MODEL_ID); + } + }; + + @Override + 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 : DRAWER_MODEL_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"); + } +} \ No newline at end of file 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 04b14cc5e..9954c7585 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 @@ -188,29 +188,29 @@ public void registerLadders() { } public void registerCounters() { - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterBlock.class).getVariantToBlockMap(), "kitchen_counter", TEMPLATE_KITCHEN_COUNTER, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterBlock.class).getVariantToBlockMapNonBase(), "kitchen_counter", TEMPLATE_KITCHEN_COUNTER, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterBlock.class).getVariantToBlockMap(), "kitchen_counter", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterBlock.class).getVariantToBlockMapNonBase(), "kitchen_counter", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenDrawerBlock.class).getVariantToBlockMap(), "kitchen_drawer", TEMPLATE_KITCHEN_DRAWER, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenDrawerBlock.class).getVariantToBlockMapNonBase(), "kitchen_drawer", TEMPLATE_KITCHEN_DRAWER, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenDrawerBlock.class).getVariantToBlockMap(), "kitchen_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenDrawerBlock.class).getVariantToBlockMapNonBase(), "kitchen_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCabinetBlock.class).getVariantToBlockMap(), "kitchen_cabinet", TEMPLATE_KITCHEN_CABINET, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCabinetBlock.class).getVariantToBlockMapNonBase(), "kitchen_cabinet", TEMPLATE_KITCHEN_CABINET, PFMBlockStateModelGenerator::createOrientableKitchenCounter, PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCabinetBlock.class).getVariantToBlockMap(), "kitchen_cabinet", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCabinetBlock.class).getVariantToBlockMapNonBase(), "kitchen_cabinet", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMap(), "kitchen_drawer", TEMPLATE_KITCHEN_WALL_DRAWER, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "kitchen_drawer", "kitchen_wall_drawer", 0), PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMapNonBase(), "kitchen_drawer", TEMPLATE_KITCHEN_WALL_DRAWER, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "kitchen_drawer", "kitchen_wall_drawer", 0), PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMap(), "kitchen_wall_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMapNonBase(), "kitchen_wall_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallCounterBlock.class).getVariantToBlockMap(), "kitchen_counter", TEMPLATE_KITCHEN_WALL_COUNTER, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "kitchen_counter", "kitchen_wall_counter", 0), PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallCounterBlock.class).getVariantToBlockMapNonBase(), "kitchen_counter", TEMPLATE_KITCHEN_WALL_COUNTER, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "kitchen_counter", "kitchen_wall_counter", 0), PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallCounterBlock.class).getVariantToBlockMap(), "kitchen_wall_counter", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallCounterBlock.class).getVariantToBlockMapNonBase(), "kitchen_wall_counter", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).getVariantToBlockMap(), "kitchen_wall_drawer_small", TEMPLATE_KITCHEN_WALL_DRAWER_SMALL, (block, identifiers) -> createSmallKitchenDrawer(block, identifiers, "", "", ""), PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).getVariantToBlockMapNonBase(), "kitchen_wall_drawer_small", TEMPLATE_KITCHEN_WALL_DRAWER_SMALL, (block, identifiers) -> createSmallKitchenDrawer(block, identifiers, "", "", ""), PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).getVariantToBlockMap(), "kitchen_wall_small_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).getVariantToBlockMapNonBase(), "kitchen_wall_small_drawer", PFMBlockStateModelGenerator::createOrientableKitchenCounter); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getVariantToBlockMap(), "kitchen_counter_oven", TEMPLATE_KITCHEN_COUNTER_OVEN, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "", "", 180), PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getVariantToBlockMapNonBase(), "kitchen_counter_oven", TEMPLATE_KITCHEN_COUNTER_OVEN, (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "_middle", "", "", 180), PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getVariantToBlockMap(), "kitchen_counter_oven", (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "", "", "", 180)); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getVariantToBlockMapNonBase(), "kitchen_counter_oven", (block, identifiers) -> createOrientableKitchenCounter(block, identifiers, "", "", "", 180)); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenSinkBlock.class).getVariantToBlockMap(), "kitchen_sink", TEMPLATE_KITCHEN_SINK, PFMBlockStateModelGenerator::createKitchenSink, PFMBlockStateModelGenerator::createCounterBlockTexture); - generateModelAndBlockStateForVariants(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenSinkBlock.class).getVariantToBlockMapNonBase(), "kitchen_sink", TEMPLATE_KITCHEN_SINK, PFMBlockStateModelGenerator::createKitchenSink, PFMBlockStateModelGenerator::createCounterBlockTexture); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenSinkBlock.class).getVariantToBlockMap(), "kitchen_sink", PFMBlockStateModelGenerator::createOrientableKitchenCounter); + generateBlockStateForBlock(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenSinkBlock.class).getVariantToBlockMapNonBase(), "kitchen_sink", PFMBlockStateModelGenerator::createOrientableKitchenCounter); } public void registerLamp() { @@ -508,7 +508,12 @@ private static BlockStateSupplier createOrientableKitchenCounter(Block block, Li Map variantMap = new HashMap<>(); String path = modelIdentifiers.get(0).getPath().replaceAll(override, ""); String name = path.split(path.substring(path.lastIndexOf('/')))[0] + path.substring(path.lastIndexOf('/')); - Identifier id = new Identifier(modelIdentifiers.get(0).getNamespace(), name.replace(furnitureName, replacement)); + Identifier id; + if (modelIdentifiers.size() == 1) { + id = modelIdentifiers.get(0); + } else { + id = new Identifier(modelIdentifiers.get(0).getNamespace(), name.replace(furnitureName, replacement)); + } Integer[] rotationArray = new Integer[]{0, 90, 180, 270}; for (int i = 0; rotationArray.length > i; i++) { if (rotationArray[i] + rotation > 270) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java index fb5b531fd..bf949de3e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java @@ -674,7 +674,7 @@ public static Pair getCounterMaterials(VariantBase variantBase) counterTop = Blocks.POLISHED_BLACKSTONE; counterBase = Blocks.CRIMSON_PLANKS; } - return new Pair<>(counterTop, counterBase); + return new Pair<>(counterBase,counterTop); } public Block getVanillaBed(Block block) { if (block instanceof SimpleBedBlock){ diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet.json index 39aeeee01..cc0b08326 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left.json index 312535d8f..9b4b568d7 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left_open.json index de573f931..08dc9c4af 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_left_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right.json index 71d4bad6d..f93d704b0 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right_open.json index b27afe3d6..6d78e7868 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_edge_right_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_left.json index 29645f1d4..384c598ae 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_left.json index b45af1d4c..96e8ff7cb 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_right.json index 226e0294c..da8539c4a 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_open_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_right.json index b5e317a9a..e9889bdc1 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_inner_corner_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_open.json index 6b94078b6..874c2778a 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_left.json index 7030e567e..907cc779e 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_left.json index a626dae11..2ffc9ff49 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_right.json index 3f70f0403..38d236bdd 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_open_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_right.json index 7ca447410..f92943130 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_cabinet/kitchen_cabinet_outer_corner_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter.json index 665a9903f..fb7e6a0cc 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom.json index 096816cdd..9202dc0c4 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_inner_corner.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_inner_corner.json index dee6da0f6..43efa2ae9 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_inner_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_inner_corner.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_outer_corner.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_outer_corner.json index ac981cd13..b0858eafe 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_outer_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_bottom_outer_corner.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_left.json index 03e0b1b74..57b1cb763 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_left.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_right.json index 1f22da86a..1cbb0be55 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_edge_right.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_left.json index 55625a3b1..c377f19d9 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_left.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_right.json index fa54a41a1..5d095dce9 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_inner_corner_right.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle.json index 87350bfe6..cd1dc1709 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_left.json index f02d80499..5155ea73c 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_left.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_right.json index 1339389a3..8b2c43142 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_inner_corner_right.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_left.json index c261552d1..e3bd8a81c 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_left.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_right.json index e102d44da..ed1b44c2c 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_middle_outer_corner_right.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_left.json index 5fe87cc09..f974487cc 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_left.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#log", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_log", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_right.json index 5ae9f7a45..e49840dcc 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_counter_outer_corner_right.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "base": "#texture", - "particle": "#log", - "legs": "#log" + "base": "minecraft:block/oak_planks", + "particle": "minecraft:block/oak_log", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven.json index 353e1aee0..c7d097af1 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven.json @@ -5,9 +5,9 @@ "3": "block/light_gray_concrete", "4": "block/iron_block", "5": "block/gray_concrete", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle.json index f9b0d94a8..5328e6fda 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle.json @@ -5,8 +5,8 @@ "3": "block/light_gray_concrete", "4": "block/iron_block", "5": "block/gray_concrete", - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle_open.json index 4b6e56e92..002cc39ee 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_middle_open.json @@ -5,8 +5,8 @@ "3": "block/light_gray_concrete", "4": "block/iron_block", "5": "block/gray_concrete", - "particle": "#texture", - "base": "#texture" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_open.json index c154747a0..4c506628a 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter_oven/kitchen_counter_oven_open.json @@ -5,9 +5,9 @@ "3": "block/light_gray_concrete", "4": "block/iron_block", "5": "block/gray_concrete", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer.json index a75d1cf3b..0b0dfb46d 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom.json index 1dd91705f..71a85c789 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_inner_corner.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_inner_corner.json index 2031b4648..267c2aae8 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_inner_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_inner_corner.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_open.json index 8d38a47f4..d3c1f71ac 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner.json index 64596a9e7..0a7ff6778 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_mirrored.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_mirrored.json index f1b19d0df..a17df865d 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_mirrored.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_mirrored.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_open.json index 884db55e9..ac5b814d9 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_bottom_outer_corner_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left.json index ca9cd7c5b..0f20744ef 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left_open.json index 337aa19e2..e456140ff 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_left_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right.json index b2609e889..40d8e488f 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right_open.json index 8adf36c2d..f9c7af196 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_edge_right_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_left.json index 8ba978909..4e1afae32 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_left.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_right.json index 54ffcbba8..e1f26db8e 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_inner_corner_right.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle.json index b16f512b2..62bddec1f 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left.json index b8cbd4098..34d08947a 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_left.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right.json index 5f7e8e284..e05b867f8 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_inner_corner_right.json @@ -1,9 +1,9 @@ { "credit": "By UnlikePaladin", "textures": { - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_open.json index 5e1783c08..36552ee1e 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_left.json index 79acfb7f5..012f723ae 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_left.json index 91256a4df..ba4b364d3 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_right.json index bbf48216e..f78938ae6 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_open_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_right.json index ea15366c7..8ad2dfffd 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_middle_outer_corner_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_open.json index c605b4e53..429f7d108 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_left.json index 03408f1d2..e95936396 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_left.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_left.json index 7fb09a03c..eb4681d90 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_left.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_left.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_right.json index 8c258c461..888a568e2 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_open_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_right.json b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_right.json index c0fc9f96a..10b265317 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_right.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_drawer/kitchen_drawer_outer_corner_right.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink.json b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink.json index c1538015b..cccf0541c 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink.json @@ -3,9 +3,9 @@ "textures": { "sink": "block/light_gray_concrete", "hardware": "block/gray_concrete", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_full.json b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_full.json index b7deef66b..4b8cbcbb1 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_full.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_full.json @@ -3,9 +3,9 @@ "textures": { "sink": "block/light_gray_concrete", "fluid": "block/water_still", - "particle": "#texture", - "base": "#texture", - "legs": "#log", + "particle": "block/oak_planks", + "base": "block/oak_planks", + "legs": "block/oak_log", "hardware": "block/gray_concrete" }, "elements": [ diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level1.json b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level1.json index 187073802..26174273e 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level1.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level1.json @@ -4,9 +4,9 @@ "sink": "block/light_gray_concrete", "hardware": "block/gray_concrete", "fluid": "block/water_still", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level2.json b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level2.json index 4725dbc61..c759fbfaa 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level2.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_sink/kitchen_sink_level2.json @@ -4,9 +4,9 @@ "sink": "block/light_gray_concrete", "hardware": "block/gray_concrete", "fluid": "block/water_still", - "particle": "#texture", - "base": "#texture", - "legs": "#log" + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks", + "legs": "minecraft:block/oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small.json b/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small.json index e01fe305e..9ea81dd7c 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small_open.json b/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small_open.json index ece58dbc8..95df025e4 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small_open.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_wall_drawer_small/kitchen_wall_drawer_small_open.json @@ -2,9 +2,9 @@ "credit": "By UnlikePaladin", "textures": { "2": "block/stone", - "legs": "#log", - "particle": "#texture", - "base": "#texture" + "legs": "minecraft:block/oak_log", + "particle": "minecraft:block/oak_planks", + "base": "minecraft:block/oak_planks" }, "elements": [ { diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java index 7a59a4d2e..7b5679ba1 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/FabricKitchenCabinetModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCabinetBlock; import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -21,8 +22,8 @@ import java.util.function.Supplier; public class FabricKitchenCabinetModel extends PFMFabricBakedModel { - public FabricKitchenCabinetModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); + public FabricKitchenCabinetModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @Override public boolean isVanillaAdapter() { @@ -36,6 +37,8 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction = state.get(KitchenCabinetBlock.FACING); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); int openOffset = state.get(KitchenWallDrawerBlock.OPEN) ? 5 : 0; + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); Direction direction3 = null; Direction direction2; @@ -58,12 +61,16 @@ else if (innerCorner) { } else { ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java index 68894c51a..61ff40ca6 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/fabric/UnbakedKitchenCabinetModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCabinetModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenCabinetModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenCabinetModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java index 220f72a70..bacecb5da 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/FabricKitchenCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -22,8 +23,8 @@ import java.util.function.Supplier; public class FabricKitchenCounterModel extends PFMFabricBakedModel { - public FabricKitchenCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); + public FabricKitchenCounterModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @Override public boolean isVanillaAdapter() { @@ -39,6 +40,8 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos boolean left = block.canConnect(world, pos, direction.rotateYClockwise()); BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { @@ -73,6 +76,7 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi else { middleCounter(world, state, pos, randomSupplier, context, left, right); } + context.popTransform(); } } @@ -89,7 +93,10 @@ private void middleCounter(BlockRenderView world, BlockState state, BlockPos pos } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java index f6f688d37..bf87ed32a 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/fabric/UnbakedKitchenCounterModelImpl.java @@ -6,9 +6,15 @@ import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenCounterModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenCounterModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java index e62ff2fb9..81aa16ccb 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/FabricKitchenCounterOvenModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterOvenBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -19,20 +20,20 @@ import java.util.function.Supplier; public class FabricKitchenCounterOvenModel extends PFMFabricBakedModel { - public FabricKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = modelParts; + public FabricKitchenCounterOvenModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @Override public boolean isVanillaAdapter() { return false; } - private final List modelParts; @Override public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { if (state.getBlock() instanceof KitchenCounterOvenBlock) { + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); boolean up = KitchenCounterOvenBlock.connectsVertical(world.getBlockState(pos.up()).getBlock()); boolean down = KitchenCounterOvenBlock.connectsVertical(world.getBlockState(pos.down()).getBlock()); int openOffset = state.get(KitchenCounterOvenBlock.OPEN) ? 2 : 0; @@ -41,12 +42,16 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos } else { ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java index f6e9b24bc..ea802ced7 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/fabric/UnbakedKitchenCounterOvenModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterOvenModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenCounterOvenModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenCounterOvenModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java index 71bdacb46..c543d5742 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/FabricKitchenDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -22,11 +23,9 @@ import java.util.function.Supplier; public class FabricKitchenDrawerModel extends PFMFabricBakedModel { - public FabricKitchenDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public FabricKitchenDrawerModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -42,6 +41,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); int openOffset = state.get(KitchenDrawerBlock.OPEN) ? 7 : 0; + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { @@ -73,8 +75,10 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi middleCounter(world, state, pos, randomSupplier, context, left, right, openOffset); } } - else + else { middleCounter(world, state, pos, randomSupplier, context, left, right, openOffset); + } + context.popTransform(); } } @@ -92,7 +96,10 @@ private void middleCounter(BlockRenderView world, BlockState state, BlockPos pos @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java index 7074d16ae..7a3ced25c 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/fabric/UnbakedKitchenDrawerModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenDrawerModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenDrawerModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenDrawerModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/FabricKitchenSinkModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/FabricKitchenSinkModel.java new file mode 100644 index 000000000..eed3034fb --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/FabricKitchenSinkModel.java @@ -0,0 +1,54 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenSink.fabric; + +import com.unlikepaladin.pfm.blocks.KitchenSinkBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.util.math.Direction; +import net.minecraft.world.BlockRenderView; + +import java.util.List; +import java.util.Random; +import java.util.function.Supplier; + +public class FabricKitchenSinkModel extends PFMFabricBakedModel { + public FabricKitchenSinkModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); + } + + @Override + public boolean isVanillaAdapter() { + return false; + } + + @Override + public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + if (state.getBlock() instanceof KitchenSinkBlock) { + int level = state.get(KitchenSinkBlock.LEVEL_4); + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(level)).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java new file mode 100644 index 000000000..ed2b65c88 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/fabric/UnbakedKitchenSinkModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenSink.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedKitchenSinkModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenSinkModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java index d3941b9d0..58857510c 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/FabricKitchenWallCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -22,11 +23,9 @@ import java.util.function.Supplier; public class FabricKitchenWallCounterModel extends PFMFabricBakedModel { - public FabricKitchenWallCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public FabricKitchenWallCounterModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; @Override public boolean isVanillaAdapter() { return false; @@ -39,6 +38,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos Direction direction = state.get(KitchenWallCounterBlock.FACING); BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { @@ -73,12 +75,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi else { ((FabricBakedModel) getTemplateBakedModels().get((0))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java index c2df5aa72..009e18d60 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/fabric/UnbakedKitchenWallCounterModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallCounterModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenWallCounterModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenWallCounterModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java index d2e2d082d..abd47f2ef 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/FabricKitchenWallDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; 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; @@ -22,11 +23,10 @@ import java.util.function.Supplier; public class FabricKitchenWallDrawerModel extends PFMFabricBakedModel { - public FabricKitchenWallDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public FabricKitchenWallDrawerModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; + @Override public boolean isVanillaAdapter() { return false; @@ -40,6 +40,9 @@ public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); int openOffset = state.get(KitchenWallDrawerBlock.OPEN) ? 5 : 0; + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && block.isDifferentOrientation(state, world, pos, direction2.getOpposite())) { @@ -74,12 +77,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi else { ((FabricBakedModel) getTemplateBakedModels().get((openOffset))).emitBlockQuads(world, state, pos, randomSupplier, context); } + context.popTransform(); } } @Override public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { - + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get((0))).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java index 7761ba800..b286608bb 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/fabric/UnbakedKitchenWallDrawerModelImpl.java @@ -1,14 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawer.fabric; +import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.fabric.FabricKitchenDrawerModel; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new FabricKitchenWallDrawerModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenWallDrawerModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/FabricKitchenWallDrawerSmallModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/FabricKitchenWallDrawerSmallModel.java new file mode 100644 index 000000000..7ed4cdc49 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/FabricKitchenWallDrawerSmallModel.java @@ -0,0 +1,54 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.fabric; + +import com.unlikepaladin.pfm.blocks.KitchenSinkBlock; +import com.unlikepaladin.pfm.blocks.KitchenWallDrawerSmallBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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 FabricKitchenWallDrawerSmallModel extends PFMFabricBakedModel { + public FabricKitchenWallDrawerSmallModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); + } + + @Override + public boolean isVanillaAdapter() { + return false; + } + + @Override + public void emitBlockQuads(BlockRenderView world, BlockState state, BlockPos pos, Supplier randomSupplier, RenderContext context) { + if (state.getBlock() instanceof KitchenWallDrawerSmallBlock) { + int openOffset = state.get(KitchenWallDrawerSmallBlock.OPEN) ? 1 : 0; + List spriteList = getSpriteList(state); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(openOffset)).emitBlockQuads(world, state, pos, randomSupplier, context); + context.popTransform(); + } + } + + @Override + public void emitItemQuads(ItemStack stack, Supplier randomSupplier, RenderContext context) { + List spriteList = getSpriteList(stack); + pushTextureTransform(context, ModelHelper.getOakPlankLogSprites(), spriteList); + ((FabricBakedModel) getTemplateBakedModels().get(0)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); + } + + @Override + public Sprite pfm$getParticle(BlockState state) { + return getSpriteList(state).get(0); + } +} diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java new file mode 100644 index 000000000..1e4678f42 --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/fabric/UnbakedKitchenWallDrawerSmallModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.fabric; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedKitchenWallDrawerSmallModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricKitchenWallDrawerSmallModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} 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 b1bb13ef8..816544fe3 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 @@ -18,6 +18,8 @@ import com.unlikepaladin.pfm.blocks.models.kitchenCounter.UnbakedKitchenCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.UnbakedKitchenCounterOvenModel; import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; +import com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; +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.logStool.UnbakedLogStoolModel; @@ -80,12 +82,30 @@ public void provideExtraModels(ResourceManager manager, Consumer out for (Identifier id : UnbakedLogStoolModel.LOG_STOOL_PARTS_BASE) { out.accept(id); } - UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedKitchenWallCounterModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedKitchenWallDrawerModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedKitchenCabinetModel.ALL_MODEL_IDS.forEach(out::accept); - UnbakedKitchenCounterOvenModel.ALL_MODEL_IDS.forEach(out::accept); + for (Identifier id : UnbakedKitchenCounterModel.COUNTER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenDrawerModel.COUNTER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenCabinetModel.CABINET_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenWallDrawerModel.COUNTER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenWallCounterModel.COUNTER_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenCounterOvenModel.OVEN_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenSinkModel.SINK_MODEL_PARTS_BASE) { + out.accept(id); + } + for (Identifier id : UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_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 781589c7e..9ef0ec10d 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 @@ -19,8 +19,10 @@ import com.unlikepaladin.pfm.blocks.models.kitchenCounter.UnbakedKitchenCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.UnbakedKitchenCounterOvenModel; import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; +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.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -85,34 +87,40 @@ else if (UnbakedModernStoolModel.MODERN_STOOL_MODEL_IDS.contains(resourceId)){ else if (UnbakedLogStoolModel.LOG_STOOL_MODEL_IDS.contains(resourceId)){ return new UnbakedLogStoolModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenCounterModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenDrawerModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenWallCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenWallCounterModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenWallDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenWallDrawerModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenCabinetModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenCabinetModel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ - return new UnbakedKitchenCounterOvenModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenCounterOvenModel(); } - else if (ModelHelper.containsIdentifier(UnbakedIronFridgeModel.IRON_FRIDGE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (UnbakedKitchenSinkModel.SINK_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenSinkModel(); + } + else if (UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_IDS.contains(resourceId)){ + return new UnbakedKitchenWallDrawerSmallModel(); + } + else if (UnbakedIronFridgeModel.IRON_FRIDGE_MODEL_IDS.contains(resourceId)){ return new UnbakedIronFridgeModel(); } - else if (ModelHelper.containsIdentifier(UnbakedFridgeModel.FRIDGE_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (UnbakedFridgeModel.FRIDGE_MODEL_IDS.contains(resourceId)){ return new UnbakedFridgeModel(resourceId); } - else if (ModelHelper.containsIdentifier(UnbakedFreezerModel.FREEZER_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (UnbakedFreezerModel.FREEZER_MODEL_IDS.contains(resourceId)){ return new UnbakedFreezerModel(resourceId); } - else if (ModelHelper.containsIdentifier(UnbakedBasicLampModel.LAMP_MODEL_IDS.toArray(new Identifier[0]), resourceId)){ + else if (UnbakedBasicLampModel.LAMP_MODEL_IDS.contains(resourceId)){ return new UnbakedBasicLampModel(); } else diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java index d496c4b30..9596cf283 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/ForgeKitchenCabinetModel.java @@ -3,6 +3,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCabinetBlock; import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.BlockState; @@ -10,6 +11,7 @@ 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.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -23,20 +25,31 @@ import java.util.*; public class ForgeKitchenCabinetModel extends PFMForgeBakedModel { - public ForgeKitchenCabinetModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public ForgeKitchenCabinetModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(NEIGHBOR_FACING); + builder.withProperty(NEIGHBOR_OPPOSITE); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenCabinetBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + KitchenCabinetBlock block = (KitchenCabinetBlock) state.getBlock(); Direction direction = state.get(KitchenCabinetBlock.FACING); BlockState neighborStateOpposite = world.getBlockState(pos.offset(direction.getOpposite())); @@ -54,9 +67,12 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, innerCorner); set.set(1, isNeighborStateOppositeFacingDifferentDirection); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)).withInitial(NEIGHBOR_OPPOSITE, neighborStateOpposite).withInitial(NEIGHBOR_FACING, blockState); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(NEIGHBOR_OPPOSITE, neighborStateOpposite); + data.setData(NEIGHBOR_FACING, blockState); + return data; } - return builder.build(); + return tileData; } @NotNull @@ -67,6 +83,7 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction KitchenCabinetBlock block = (KitchenCabinetBlock) state.getBlock(); Direction direction = state.get(KitchenCabinetBlock.FACING); BlockState neighborStateOpposite = extraData.getData(NEIGHBOR_OPPOSITE); + List spriteList = getSpriteList(state); Direction direction3 = null; if (neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -79,22 +96,28 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean isNeighborStateOppositeFacingDifferentDirection = set.get(1); if (block.isCabinet(blockState) && (direction2 = blockState.get(KitchenCabinetBlock.FACING)).getAxis() != state.get(KitchenCabinetBlock.FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(3 + openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(3 + openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(4 + openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(4 + openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else if (innerCorner) { if (direction3 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(2 + openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(2 + openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(1 + openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(1 + openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } return Collections.emptyList(); } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); + } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java index 27289069b..d3321462f 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCabinet/forge/UnbakedKitchenCabinetModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCabinetModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenCabinetModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenCabinetModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java index fb3dc2403..7408f65b4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/ForgeKitchenCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; @@ -10,6 +11,7 @@ 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.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -23,18 +25,30 @@ import java.util.*; public class ForgeKitchenCounterModel extends PFMForgeBakedModel { - public ForgeKitchenCounterModel(Sprite frame, ModelBakeSettings settings, List modelParts) { + public ForgeKitchenCounterModel(ModelBakeSettings settings, List modelParts) { super(settings, modelParts); } public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(NEIGHBOR_FACING); + builder.withProperty(NEIGHBOR_OPPOSITE); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenCounterBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + KitchenCounterBlock block = (KitchenCounterBlock) state.getBlock(); Direction direction = state.get(KitchenCounterBlock.FACING); boolean right = block.canConnect(world, pos, direction.rotateYCounterclockwise()); @@ -67,9 +81,12 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos set.set(1, right); set.set(2, isNeighborStateOppositeFacingDifferentDirection); set.set(3, isNeighborStateFacingDifferentDirection); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)).withInitial(NEIGHBOR_FACING, neighborStateFacing).withInitial(NEIGHBOR_OPPOSITE, neighborStateOpposite); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(NEIGHBOR_FACING, neighborStateFacing); + data.setData(NEIGHBOR_OPPOSITE, neighborStateOpposite); + return data; } - return builder.build(); + return tileData; } @NotNull @@ -85,18 +102,18 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean isNeighborStateFacingDifferentDirection = set.get(3); BlockState neighborStateFacing = extraData.getData(NEIGHBOR_FACING); BlockState neighborStateOpposite = extraData.getData(NEIGHBOR_OPPOSITE); - + List spriteList = getSpriteList(state); if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(5).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(6).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getMiddleQuads(state, side, rand, extraData, left, right); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right), ModelHelper.getOakPlankLogSprites(), spriteList); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -109,21 +126,27 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getMiddleQuads(state, side, rand, extraData, left, right); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getMiddleQuads(state, side, rand, extraData, left, right); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right), ModelHelper.getOakPlankLogSprites(), spriteList); } } return Collections.emptyList(); } + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); + } + private List getMiddleQuads(BlockState state, Direction side, Random rand, IModelData extraData, boolean left, boolean right) { if (left && right) { return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java index 5b48b5b00..b1446b9de 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounter/forge/UnbakedKitchenCounterModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenCounterModel(frame, settings, bakedModels.values().stream().toList()); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenCounterModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java index 2e68e5ae5..bbc59fb02 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/ForgeKitchenCounterOvenModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenCounterOvenBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.BlockState; @@ -9,6 +10,7 @@ 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.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -21,39 +23,56 @@ import java.util.*; public class ForgeKitchenCounterOvenModel extends PFMForgeBakedModel { - private final List modelParts; - public ForgeKitchenCounterOvenModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List modelParts) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = modelParts; + public ForgeKitchenCounterOvenModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); + } + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); } @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && state.getBlock() instanceof KitchenCounterOvenBlock && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List quads = new ArrayList<>(); BitSet data = extraData.getData(CONNECTIONS).connections; int openOffset = state.get(KitchenCounterOvenBlock.OPEN) ? 2 : 0; + List spriteList = getSpriteList(state); if (data.get(0) || data.get(1)) { quads.addAll(getTemplateBakedModels().get(1 + openOffset).getQuads(state, side, rand, extraData)); } else { quads.addAll(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData)); } + return getQuadsWithTexture(quads, ModelHelper.getOakPlankLogSprites(), spriteList); } - return quads; + return Collections.emptyList(); } public static ModelProperty CONNECTIONS = new ModelProperty<>(); @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenCounterOvenBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + BitSet set = new BitSet(); set.set(0, KitchenCounterOvenBlock.connectsVertical(world.getBlockState(pos.up()).getBlock())); set.set(1, KitchenCounterOvenBlock.connectsVertical(world.getBlockState(pos.down()).getBlock())); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + return data; } - return builder.build(); + return tileData; + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java index f1353ac13..78ba420da 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenCounterOven/forge/UnbakedKitchenCounterOvenModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenCounterOvenModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenCounterOvenModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenCounterOvenModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java index 3338e6fab..0c051d7dc 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/ForgeKitchenDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; @@ -10,6 +11,7 @@ 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.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -23,20 +25,30 @@ import java.util.*; public class ForgeKitchenDrawerModel extends PFMForgeBakedModel { - public ForgeKitchenDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public ForgeKitchenDrawerModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(NEIGHBOR_FACING); + builder.withProperty(NEIGHBOR_OPPOSITE); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenDrawerBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + KitchenDrawerBlock block = (KitchenDrawerBlock) state.getBlock(); Direction direction = state.get(KitchenDrawerBlock.FACING); boolean right = block.canConnect(world, pos, direction.rotateYCounterclockwise()); @@ -69,9 +81,12 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos set.set(1, right); set.set(2, isNeighborStateOppositeFacingDifferentDirection); set.set(3, isNeighborStateFacingDifferentDirection); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)).withInitial(NEIGHBOR_FACING, neighborStateFacing).withInitial(NEIGHBOR_OPPOSITE, neighborStateOpposite); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(NEIGHBOR_FACING, neighborStateFacing); + data.setData(NEIGHBOR_OPPOSITE, neighborStateOpposite); + return data; } - return builder.build(); + return tileData; } @Override @@ -87,17 +102,19 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction BlockState neighborStateFacing = extraData.getData(NEIGHBOR_FACING); BlockState neighborStateOpposite = extraData.getData(NEIGHBOR_OPPOSITE); int openOffset = state.get(KitchenDrawerBlock.OPEN) ? 7 : 0; + List spriteList = getSpriteList(state); + if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get((5 + openOffset)).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get((5 + openOffset)).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get((6 + openOffset)).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get((6 + openOffset)).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getMiddleQuads(state, side, rand, extraData, left, right, openOffset); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right, openOffset), ModelHelper.getOakPlankLogSprites(), spriteList); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -110,16 +127,16 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get((4 + openOffset)).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get((4 + openOffset)).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get((3 + openOffset)).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get((3 + openOffset)).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getMiddleQuads(state, side, rand, extraData, left, right, openOffset); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right, openOffset), ModelHelper.getOakPlankLogSprites(), spriteList); } } else - return getMiddleQuads(state, side, rand, extraData, left, right, openOffset); + return getQuadsWithTexture(getMiddleQuads(state, side, rand, extraData, left, right, openOffset), ModelHelper.getOakPlankLogSprites(), spriteList); } return Collections.emptyList(); } @@ -135,4 +152,10 @@ private List getMiddleQuads(BlockState state, Direction side, Random return getTemplateBakedModels().get((openOffset)).getQuads(state, side, rand, extraData); } } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); + } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java index ecc20b781..bbe97353a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenDrawer/forge/UnbakedKitchenDrawerModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenDrawerModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenDrawerModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenDrawerModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/ForgeKitchenSinkModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/ForgeKitchenSinkModel.java new file mode 100644 index 000000000..732d2cdb3 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/ForgeKitchenSinkModel.java @@ -0,0 +1,67 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenSink.forge; + +import com.unlikepaladin.pfm.blocks.KitchenSinkBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.*; + +public class ForgeKitchenSinkModel extends PFMForgeBakedModel { + public ForgeKitchenSinkModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData.getData(LEVEL) != null) { + int level = extraData.getData(LEVEL); + List originalQuads = getTemplateBakedModels().get(level).getQuads(state, side, rand, extraData); + List spriteList = getSpriteList(state); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + public static ModelProperty LEVEL = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(LEVEL); + } + + @NotNull + @Override + public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof KitchenSinkBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(LEVEL, state.get(KitchenSinkBlock.LEVEL_4)); + return data; + } + return tileData; + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(stack); + List originalQuads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java new file mode 100644 index 000000000..bb7d87d9b --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenSink/forge/UnbakedKitchenSinkModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenSink.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedKitchenSinkModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenSinkModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java index 20e3fc13c..4863119a2 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/ForgeKitchenWallCounterModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallCounterBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; @@ -10,6 +11,7 @@ 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.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -23,20 +25,31 @@ import java.util.*; public class ForgeKitchenWallCounterModel extends PFMForgeBakedModel { - public ForgeKitchenWallCounterModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public ForgeKitchenWallCounterModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; + public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(NEIGHBOR_FACING); + builder.withProperty(NEIGHBOR_OPPOSITE); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenWallCounterBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + KitchenWallCounterBlock block = (KitchenWallCounterBlock) state.getBlock(); Direction direction = state.get(KitchenWallCounterBlock.FACING); BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); @@ -65,9 +78,12 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, isNeighborStateOppositeFacingDifferentDirection); set.set(1, isNeighborStateFacingDifferentDirection); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)).withInitial(NEIGHBOR_FACING, neighborStateFacing).withInitial(NEIGHBOR_OPPOSITE, neighborStateOpposite); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(NEIGHBOR_FACING, neighborStateFacing); + data.setData(NEIGHBOR_OPPOSITE, neighborStateOpposite); + return data; } - return builder.build(); + return tileData; } @Override @@ -80,18 +96,19 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction boolean isNeighborStateFacingDifferentDirection = set.get(1); BlockState neighborStateFacing = extraData.getData(NEIGHBOR_FACING); BlockState neighborStateOpposite = extraData.getData(NEIGHBOR_OPPOSITE); + List spriteList = getSpriteList(state); if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -104,18 +121,24 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } return Collections.emptyList(); } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); + } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java index a42f21228..9b559f013 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallCounter/forge/UnbakedKitchenWallCounterModelImpl.java @@ -1,14 +1,21 @@ package com.unlikepaladin.pfm.blocks.models.kitchenWallCounter.forge; +import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.forge.ForgeKitchenDrawerModel; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallCounterModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenWallCounterModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenWallCounterModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java index 58bfb75dd..29c2491f4 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/ForgeKitchenWallDrawerModel.java @@ -2,6 +2,7 @@ import com.unlikepaladin.pfm.blocks.KitchenWallDrawerBlock; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; import net.minecraft.block.AbstractFurnaceBlock; @@ -10,6 +11,7 @@ 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.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -23,20 +25,30 @@ import java.util.*; public class ForgeKitchenWallDrawerModel extends PFMForgeBakedModel { - public ForgeKitchenWallDrawerModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - super(settings, bakedModels.values().stream().toList()); - this.modelParts = MODEL_PARTS; + public ForgeKitchenWallDrawerModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } - private final List modelParts; public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty NEIGHBOR_FACING = new ModelProperty<>(); public static ModelProperty NEIGHBOR_OPPOSITE = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(NEIGHBOR_FACING); + builder.withProperty(NEIGHBOR_OPPOSITE); + } @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); if (state.getBlock() instanceof KitchenWallDrawerBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + KitchenWallDrawerBlock block = (KitchenWallDrawerBlock) state.getBlock(); Direction direction = state.get(KitchenWallDrawerBlock.FACING); BlockState neighborStateFacing = world.getBlockState(pos.offset(direction)); @@ -65,9 +77,12 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos BitSet set = new BitSet(); set.set(0, isNeighborStateOppositeFacingDifferentDirection); set.set(1, isNeighborStateFacingDifferentDirection); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)).withInitial(NEIGHBOR_FACING, neighborStateFacing).withInitial(NEIGHBOR_OPPOSITE, neighborStateOpposite); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(NEIGHBOR_FACING, neighborStateFacing); + data.setData(NEIGHBOR_OPPOSITE, neighborStateOpposite); + return data; } - return builder.build(); + return tileData; } @Override @@ -81,17 +96,19 @@ public List getQuads(@Nullable BlockState state, @Nullable Direction BlockState neighborStateFacing = extraData.getData(NEIGHBOR_FACING); BlockState neighborStateOpposite = extraData.getData(NEIGHBOR_OPPOSITE); int openOffset = state.get(KitchenWallDrawerBlock.OPEN) ? 5 : 0; + List spriteList = getSpriteList(state); + if (block.canConnectToCounter(neighborStateFacing) && neighborStateFacing.contains(Properties.HORIZONTAL_FACING)) { Direction direction2 = neighborStateFacing.get(Properties.HORIZONTAL_FACING); if (direction2.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateFacingDifferentDirection) { if (direction2 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(3+openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(3+openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(4+openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(4+openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposite.contains(Properties.HORIZONTAL_FACING)) { @@ -104,18 +121,24 @@ else if (block.canConnectToCounter(neighborStateOpposite) && neighborStateOpposi } if (direction3.getAxis() != state.get(Properties.HORIZONTAL_FACING).getAxis() && isNeighborStateOppositeFacingDifferentDirection) { if (direction3 == direction.rotateYCounterclockwise()) { - return getTemplateBakedModels().get(2+openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(2+openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } else { - return getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(1+openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } else { - return getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); + return getQuadsWithTexture(getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData), ModelHelper.getOakPlankLogSprites(), spriteList); } } return Collections.emptyList(); } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(state); + return getQuadsWithTexture(getTemplateBakedModels().get(0).getQuads(state, face, random), ModelHelper.getOakPlankLogSprites(), spriteList); + } } \ No newline at end of file diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java index 04a655a70..33c483354 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawer/forge/UnbakedKitchenWallDrawerModelImpl.java @@ -2,13 +2,18 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedKitchenWallDrawerModelImpl { - public static BakedModel getBakedModel(Sprite frame, ModelBakeSettings settings, Map bakedModels, List MODEL_PARTS) { - return new ForgeKitchenWallDrawerModel(frame, settings, bakedModels, MODEL_PARTS); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenWallDrawerModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/ForgeKitchenWallDrawerSmallModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/ForgeKitchenWallDrawerSmallModel.java new file mode 100644 index 000000000..849a8e672 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/ForgeKitchenWallDrawerSmallModel.java @@ -0,0 +1,71 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.forge; + +import com.unlikepaladin.pfm.blocks.KitchenSinkBlock; +import com.unlikepaladin.pfm.blocks.KitchenWallDrawerSmallBlock; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; +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.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 net.minecraftforge.client.model.data.ModelProperty; +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 ForgeKitchenWallDrawerSmallModel extends PFMForgeBakedModel { + public ForgeKitchenWallDrawerSmallModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); + } + + @NotNull + @Override + public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { + if (state != null && extraData.getData(OPEN) != null) { + int openOffset = extraData.getData(OPEN) ? 1 : 0; + List originalQuads = getTemplateBakedModels().get(openOffset).getQuads(state, side, rand, extraData); + List spriteList = getSpriteList(state); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); + } + return Collections.emptyList(); + } + + public static ModelProperty OPEN = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(OPEN); + } + + @NotNull + @Override + public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { + if (state.getBlock() instanceof KitchenWallDrawerSmallBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + data.setData(OPEN, state.get(KitchenWallDrawerSmallBlock.OPEN)); + return data; + } + return tileData; + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List spriteList = getSpriteList(stack); + List originalQuads = getTemplateBakedModels().get(0).getQuads(state, face, random); + return getQuadsWithTexture(originalQuads, ModelHelper.getOakPlankLogSprites(), spriteList); + } +} diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java new file mode 100644 index 000000000..5d4a5d2a1 --- /dev/null +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/kitchenWallDrawerSmall/forge/UnbakedKitchenWallDrawerSmallModelImpl.java @@ -0,0 +1,19 @@ +package com.unlikepaladin.pfm.blocks.models.kitchenWallDrawerSmall.forge; + +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.ModelBakeSettings; + +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class UnbakedKitchenWallDrawerSmallModelImpl { + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new ForgeKitchenWallDrawerSmallModel(settings, modelParts); + modelMap.put(settings, model); + return model; + } +} 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 f24879a15..b78a42399 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 @@ -18,8 +18,10 @@ import com.unlikepaladin.pfm.blocks.models.kitchenCounter.UnbakedKitchenCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.UnbakedKitchenCounterOvenModel; import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; +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.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -121,12 +123,30 @@ public static void registerExtraModels(ModelRegistryEvent event) { for (Identifier id : UnbakedLogStoolModel.LOG_STOOL_PARTS_BASE) { ModelLoader.addSpecialModel(id); } - UnbakedKitchenCounterModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedKitchenDrawerModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedKitchenWallCounterModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedKitchenWallDrawerModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedKitchenCounterOvenModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); - UnbakedKitchenCabinetModel.ALL_MODEL_IDS.forEach(ModelLoader::addSpecialModel); + for (Identifier id : UnbakedKitchenCounterModel.COUNTER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenDrawerModel.COUNTER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenCabinetModel.CABINET_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenWallDrawerModel.COUNTER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenWallCounterModel.COUNTER_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenCounterOvenModel.OVEN_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenSinkModel.SINK_MODEL_PARTS_BASE) { + ModelLoader.addSpecialModel(id); + } + for (Identifier id : UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_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 d80e313fb..914033141 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 @@ -19,8 +19,10 @@ import com.unlikepaladin.pfm.blocks.models.kitchenCounter.UnbakedKitchenCounterModel; import com.unlikepaladin.pfm.blocks.models.kitchenCounterOven.UnbakedKitchenCounterOvenModel; import com.unlikepaladin.pfm.blocks.models.kitchenDrawer.UnbakedKitchenDrawerModel; +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.kitchenWallDrawerSmall.UnbakedKitchenWallDrawerSmallModel; import com.unlikepaladin.pfm.blocks.models.logStool.UnbakedLogStoolModel; import com.unlikepaladin.pfm.blocks.models.logTable.UnbakedLogTableModel; import com.unlikepaladin.pfm.blocks.models.mirror.UnbakedMirrorModel; @@ -98,32 +100,32 @@ else if (UnbakedModernDinnerTableModel.TABLE_MODEL_IDS.contains(modifiedId)){ this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCounterModel.COUNTER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenCounterModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenDrawerModel.DRAWER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenDrawerModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenWallCounterModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenWallCounterModel.COUNTER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenWallCounterModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenWallDrawerModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenWallDrawerModel.DRAWER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenWallDrawerModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenCabinetModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCabinetModel.CABINET_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenCabinetModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); @@ -134,8 +136,20 @@ else if (UnbakedClassicNightstandModel.NIGHSTAND_MODEL_IDS.contains(modifiedId)) this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ - UnbakedModel model = new UnbakedKitchenCounterOvenModel(ModelHelper.getVariant(resourceId), new ArrayList<>(), ModelHelper.getBlockType(resourceId)); + else if (UnbakedKitchenCounterOvenModel.OVEN_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenCounterOvenModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedKitchenSinkModel.SINK_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenSinkModel(); + this.unbakedModels.put(resourceId, model); + this.modelsToBake.put(resourceId, model); + ci.cancel(); + } + else if (UnbakedKitchenWallDrawerSmallModel.DRAWER_MODEL_IDS.contains(modifiedId)){ + UnbakedModel model = new UnbakedKitchenWallDrawerSmallModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); ci.cancel(); From 8e3a5245733a253c284a01869be7ce933758081c Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 23 Dec 2023 16:47:19 -0600 Subject: [PATCH 06/10] migrated lamps to the new model system --- .../basicLamp/UnbakedBasicLampModel.java | 45 +++---- .../data/materials/VariantRegistryBase.java | 2 +- .../assets/PFMBlockstateModelProvider.java | 7 - .../block/basic_lamp/basic_lamp_bottom.json | 4 +- .../block/basic_lamp/basic_lamp_middle.json | 2 +- .../block/basic_lamp/basic_lamp_single.json | 4 +- .../block/basic_lamp/basic_lamp_top.json | 2 +- .../fabric/FabricBasicLampModel.java | 76 +++++++---- .../fabric/UnbakedBasicLampModelImpl.java | 13 +- .../models/fabric/PFMFabricBakedModel.java | 26 ++-- .../basicLamp/forge/ForgeBasicLampModel.java | 122 ++++++++++++------ .../forge/UnbakedBasicLampModelImpl.java | 4 +- .../models/forge/PFMForgeBakedModel.java | 4 +- .../pfm/mixin/forge/PFMModelLoaderMixin.java | 2 +- 14 files changed, 186 insertions(+), 127 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java index b1695bf71..5a4b5edbb 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/UnbakedBasicLampModel.java @@ -15,6 +15,7 @@ import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; public class UnbakedBasicLampModel implements UnbakedModel { @@ -34,10 +35,10 @@ public static Identifier getItemModelId() { } public static final List MODEL_PARTS_BASE = new ArrayList<>() {{ - add("block/basic_lamp/template_basic_lamp/template_basic_lamp_bottom"); - add("block/basic_lamp/template_basic_lamp/template_basic_lamp_middle"); - add("block/basic_lamp/template_basic_lamp/template_basic_lamp_single"); - add("block/basic_lamp/template_basic_lamp/template_basic_lamp_top"); + add("block/basic_lamp/basic_lamp_bottom"); + add("block/basic_lamp/basic_lamp_middle"); + add("block/basic_lamp/basic_lamp_single"); + add("block/basic_lamp/basic_lamp_top"); }}; public static final List STATIC_PARTS = new ArrayList<>() {{ @@ -48,11 +49,8 @@ public static Identifier getItemModelId() { private static final Identifier PARENT = new Identifier("block/block"); public static final List ALL_MODEL_IDS = new ArrayList<>() { { - for (WoodVariant variant : WoodVariantRegistry.getVariants()) { - for (String part : MODEL_PARTS_BASE) { - String newPart = part.replaceAll("template", variant.asString()); - add(new Identifier(PaladinFurnitureMod.MOD_ID, newPart)); - } + for (String part : MODEL_PARTS_BASE) { + add(new Identifier(PaladinFurnitureMod.MOD_ID, part)); } for (String part : STATIC_PARTS) { add(new Identifier(PaladinFurnitureMod.MOD_ID, part)); @@ -64,10 +62,7 @@ public static Identifier getItemModelId() { Map textureMap = new HashMap<>(); @Override public Collection getTextureDependencies(Function unbakedModelGetter, Set> unresolvedTextureReferences) { - for (WoodVariant variant : WoodVariantRegistry.getVariants()) { - textureMap.put(variant, new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG))); - } - return textureMap.values(); + return Collections.emptyList(); } @Override @@ -75,27 +70,23 @@ public Collection getModelDependencies() { return Collections.singleton(PARENT); } + public static final Map> CACHED_MODELS = new ConcurrentHashMap<>(); @Nullable @Override public BakedModel bake(ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { - Map> bakedModels = new LinkedHashMap<>(); - List parts = new ArrayList<>(MODEL_PARTS_BASE); - parts.addAll(STATIC_PARTS); - for (WoodVariant woodVariant : WoodVariantRegistry.getVariants()) { - bakedModels.put(woodVariant, new LinkedHashMap<>()); - for (String part : parts) { - bakedModels.get(woodVariant).put(part, loader.bake(new Identifier(PaladinFurnitureMod.MOD_ID, part.replaceAll("template", woodVariant.asString())), rotationContainer)); - } - } - Map spriteMap = new HashMap<>(); - for (Map.Entry spriteIdentifierEntry : textureMap.entrySet()) { - spriteMap.put(spriteIdentifierEntry.getKey(), textureGetter.apply(spriteIdentifierEntry.getValue())); + if (CACHED_MODELS.containsKey(rotationContainer)) + return getBakedModel(rotationContainer, CACHED_MODELS.get(rotationContainer)); + + List bakedModelList = new ArrayList<>(); + for (Identifier modelPart : ALL_MODEL_IDS) { + bakedModelList.add(loader.bake(modelPart, rotationContainer)); } - return getBakedModel(spriteMap, rotationContainer, bakedModels, parts); + CACHED_MODELS.put(rotationContainer, bakedModelList); + return getBakedModel(rotationContainer, bakedModelList); } @ExpectPlatform - public static BakedModel getBakedModel(Map textures, ModelBakeSettings settings, Map> variantToModelMap, List modelParts) { + 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/data/materials/VariantRegistryBase.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java index c91364758..583e48568 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/VariantRegistryBase.java @@ -33,7 +33,7 @@ protected void finalizeAndFreeze() { if (Objects.equals(entry.getNamespace(), modId)) { if (!linkedHashMap.containsKey(entry.getIdentifier())) { linkedHashMap.put(entry.getIdentifier(), entry); - }else if (entry != WoodVariantRegistry.OAK) { + }else if (entry.getIdentifier() != WoodVariantRegistry.OAK.getIdentifier()) { PaladinFurnitureMod.GENERAL_LOGGER.warn("Found block type with duplicate id ({}), skipping",entry.identifier); } } 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 9954c7585..203dc7faa 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 @@ -215,13 +215,6 @@ public void registerCounters() { public void registerLamp() { Identifier modelID = ModelIds.getBlockModelId(PaladinFurnitureModBlocksItems.BASIC_LAMP); - for (WoodVariant variant : WoodVariantRegistry.getVariants()) { - Texture blockTexture = createRawBlockTexture(true, variant); - for (Model model : TEMPLATE_LAMP_ARRAY) { - Identifier id = new Identifier(modelID.getNamespace(), ModelIDS.get(model).getPath().replace("template_", "").replace("template", "").replaceAll("basic_lamp", variant.asString() + "_basic_lamp").replace("block/", "block/basic_lamp/").replace("//", "/")); - model.upload(id, blockTexture, this.modelCollector); - } - } this.blockStateCollector.accept(createSingleStateBlockState(PaladinFurnitureModBlocksItems.BASIC_LAMP, List.of(modelID))); PFMBlockstateModelProvider.modelPathMap.put(PaladinFurnitureModBlocksItems.BASIC_LAMP, UnbakedBasicLampModel.getItemModelId()); } diff --git a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_bottom.json b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_bottom.json index 89a63579d..22e877e18 100644 --- a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_bottom.json +++ b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_bottom.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "texture": "#texture" + "particle": "minecraft:block/stripped_oak_log", + "texture": "minecraft:block/stripped_oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_middle.json b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_middle.json index 71b84cbdf..d5c7a5e7b 100644 --- a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_middle.json +++ b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_middle.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "texture": "#texture" + "texture": "minecraft:block/stripped_oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_single.json b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_single.json index 5c9814db1..4df9971cb 100644 --- a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_single.json +++ b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_single.json @@ -1,8 +1,8 @@ { "credit": "By UnlikePaladin", "textures": { - "particle": "#texture", - "texture": "#texture" + "particle": "minecraft:block/stripped_oak_log", + "texture": "minecraft:block/stripped_oak_log" }, "elements": [ { diff --git a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_top.json b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_top.json index 09cb5b0f4..2c1260431 100644 --- a/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_top.json +++ b/common/src/main/resources/assets/pfm/models/block/basic_lamp/basic_lamp_top.json @@ -1,7 +1,7 @@ { "credit": "By UnlikePaladin", "textures": { - "texture": "#texture" + "texture": "minecraft:block/stripped_oak_log" }, "elements": [ { diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java index 8f183d06d..96d43f404 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java @@ -3,6 +3,8 @@ import com.unlikepaladin.pfm.blocks.BasicLampBlock; import com.unlikepaladin.pfm.blocks.blockentities.LampBlockEntity; import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; +import com.unlikepaladin.pfm.blocks.models.fabric.PFMFabricBakedModel; +import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; @@ -13,27 +15,20 @@ import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.render.model.json.ModelTransformation; import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.item.ItemStack; +import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.state.property.Properties; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Random; +import java.util.*; import java.util.function.Supplier; -public class FabricBasicLampModel extends AbstractBakedModel implements FabricBakedModel { - private final List modelParts; - private final Map> bakedModels; - private final Map textureMap; - public FabricBasicLampModel(Map textures, ModelBakeSettings settings, Map> bakedModels, List modelParts) { - super(settings, bakedModels.get(WoodVariantRegistry.OAK).values().stream().toList()); - this.modelParts = modelParts; - this.textureMap = textures; - this.bakedModels = bakedModels; +public class FabricBasicLampModel extends PFMFabricBakedModel { + public FabricBasicLampModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } @Override @@ -51,21 +46,23 @@ public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos } boolean up = blockView.getBlockState(pos.up()).getBlock() instanceof BasicLampBlock; boolean down = blockView.getBlockState(pos.down()).getBlock() instanceof BasicLampBlock; + pushTextureTransform(context, getOakStrippedLogSprite(), getVariantStrippedLogSprite(variant)); if (up && down) { - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(1))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(1)).emitBlockQuads(blockView, state, pos, randomSupplier, context); } else if (up) { - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(0))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(0)).emitBlockQuads(blockView, state, pos, randomSupplier, context); } else if (down) { - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(3))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(5+onOffset))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(3)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(5+onOffset)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(4)).emitBlockQuads(blockView, state, pos, randomSupplier, context); } else { - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(4))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(2))).emitBlockQuads(blockView, state, pos, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(5+onOffset))).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(4)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(2)).emitBlockQuads(blockView, state, pos, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(5+onOffset)).emitBlockQuads(blockView, state, pos, randomSupplier, context); } + context.popTransform(); } @Override @@ -74,18 +71,41 @@ public void emitItemQuads(ItemStack stack, Supplier randomSupplier, Rend if (stack.hasNbt()) { variant = WoodVariantRegistry.getVariant(Identifier.tryParse(stack.getSubNbt("BlockEntityTag").getString("variant"))); } - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(4))).emitItemQuads(stack, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(2))).emitItemQuads(stack, randomSupplier, context); - ((FabricBakedModel)bakedModels.get(variant).get(modelParts.get(5))).emitItemQuads(stack, randomSupplier, context); + pushTextureTransform(context, getOakStrippedLogSprite(), getVariantStrippedLogSprite(variant)); + ((FabricBakedModel)getTemplateBakedModels().get(4)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(2)).emitItemQuads(stack, randomSupplier, context); + ((FabricBakedModel)getTemplateBakedModels().get(5)).emitItemQuads(stack, randomSupplier, context); + context.popTransform(); } @Override - public Sprite getParticleSprite() { - return bakedModels.get(WoodVariantRegistry.OAK).get(modelParts.get(4)).getParticleSprite(); + public ModelTransformation getTransformation() { + return getTemplateBakedModels().get(2).getTransformation(); + } + + static List oakSprite = new ArrayList<>(); + static List getOakStrippedLogSprite() { + if (!oakSprite.isEmpty()) + return oakSprite; + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + oakSprite.add(wood); + return oakSprite; + } + + static Map> sprites = new HashMap<>(); + static List getVariantStrippedLogSprite(WoodVariant variant) { + if (sprites.containsKey(variant)) + return sprites.get(variant); + + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + List spriteList = new ArrayList<>(); + spriteList.add(wood); + sprites.put(variant, spriteList); + return spriteList; } @Override - public ModelTransformation getTransformation() { - return bakedModels.get(WoodVariantRegistry.OAK).get(modelParts.get(2)).getTransformation(); + public Sprite pfm$getParticle(BlockState state) { + return getTemplateBakedModels().get(4).getParticleSprite(); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java index 56b7187b2..3a7677f7e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/UnbakedBasicLampModelImpl.java @@ -1,16 +1,19 @@ package com.unlikepaladin.pfm.blocks.models.basicLamp.fabric; -import com.unlikepaladin.pfm.data.materials.WoodVariant; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; -import net.minecraft.client.texture.Sprite; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; public class UnbakedBasicLampModelImpl { - - public static BakedModel getBakedModel(Map textures, ModelBakeSettings settings, Map> variantToModelMap, List modelParts) { - return new FabricBasicLampModel(textures, settings, variantToModelMap, modelParts); + static Map modelMap = new ConcurrentHashMap<>(); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + if (modelMap.containsKey(settings)) + return modelMap.get(settings); + BakedModel model = new FabricBasicLampModel(settings, modelParts); + modelMap.put(settings, model); + return model; } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java index 70bbf2f1c..0d621f44a 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java @@ -39,19 +39,21 @@ public void pushTextureTransform(RenderContext context, List toReplace, } public void pushTextureTransform(RenderContext context, List toReplace, List replacement, Identifier atlasId) { context.pushTransform(quad -> { - Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(atlasId)).find(quad, 0); - Identifier keyId = originalSprite.getId(); - int textureIndex = IntStream.range(0, toReplace.size()) - .filter(i -> keyId.equals(toReplace.get(i).getId())) - .findFirst() - .orElse(-1); + if (replacement != null && toReplace != null ){ + Sprite originalSprite = SpriteFinder.get(MinecraftClient.getInstance().getBakedModelManager().getAtlas(atlasId)).find(quad, 0); + Identifier keyId = originalSprite.getId(); + int textureIndex = IntStream.range(0, toReplace.size()) + .filter(i -> keyId.equals(toReplace.get(i).getId())) + .findFirst() + .orElse(-1); - if (textureIndex != -1 && !toReplace.equals(replacement)) { - Sprite sprite = replacement.get(textureIndex); - for (int index = 0; index < 4; index++) { - float frameU = originalSprite.method_35804(quad.spriteU(index, 0)); - float frameV = originalSprite.method_35805(quad.spriteV(index, 0)); - quad.sprite(index, 0, sprite.getFrameU(frameU), sprite.getFrameV(frameV)); + if (textureIndex != -1 && !toReplace.equals(replacement)) { + Sprite sprite = replacement.get(textureIndex); + for (int index = 0; index < 4; index++) { + float frameU = originalSprite.method_35804(quad.spriteU(index, 0)); + float frameV = originalSprite.method_35805(quad.spriteV(index, 0)); + quad.sprite(index, 0, sprite.getFrameU(frameU), sprite.getFrameV(frameV)); + } } } return true; diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java index 9e9512934..2f7cc4e1a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/ForgeBasicLampModel.java @@ -1,22 +1,24 @@ package com.unlikepaladin.pfm.blocks.models.basicLamp.forge; -import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.blocks.BasicLampBlock; import com.unlikepaladin.pfm.blocks.blockentities.LampBlockEntity; -import com.unlikepaladin.pfm.blocks.models.AbstractBakedModel; import com.unlikepaladin.pfm.blocks.models.forge.ModelBitSetProperty; +import com.unlikepaladin.pfm.blocks.models.forge.PFMForgeBakedModel; +import com.unlikepaladin.pfm.data.materials.BlockType; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; -import net.minecraft.client.render.RenderLayer; 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.render.model.json.ModelTransformation; import net.minecraft.client.texture.Sprite; +import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.item.ItemStack; +import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.state.property.Properties; +import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.world.BlockRenderView; @@ -28,62 +30,94 @@ import java.util.*; -public class ForgeBasicLampModel extends AbstractBakedModel { - private final List modelParts; - private final Map> bakedModels; - private final Map textureMap; - public ForgeBasicLampModel(Map textures, ModelBakeSettings settings, Map> bakedModels, List modelParts) { - super(settings, bakedModels.get(WoodVariantRegistry.OAK).values().stream().toList()); - this.modelParts = modelParts; - this.textureMap = textures; - this.bakedModels = bakedModels; +public class ForgeBasicLampModel extends PFMForgeBakedModel { + public ForgeBasicLampModel(ModelBakeSettings settings, List modelParts) { + super(settings, modelParts); } public static ModelProperty CONNECTIONS = new ModelProperty<>(); public static ModelProperty VARIANT = new ModelProperty<>(); + @Override + public void appendProperties(ModelDataMap.Builder builder) { + super.appendProperties(builder); + builder.withProperty(CONNECTIONS); + builder.withProperty(VARIANT); + } + @NotNull @Override public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos pos, @NotNull BlockState state, @NotNull IModelData tileData) { - ModelDataMap.Builder builder = new ModelDataMap.Builder(); - WoodVariant variant = WoodVariantRegistry.OAK; - BlockEntity entity = world.getBlockEntity(pos); - if (entity instanceof LampBlockEntity) { - variant = ((LampBlockEntity) entity).getVariant(); + if (state.getBlock() instanceof BasicLampBlock) { + ModelDataMap.Builder builder = new ModelDataMap.Builder(); + appendProperties(builder); + + IModelData data = builder.build(); + super.getModelData(world, pos, state, data); + + WoodVariant variant = WoodVariantRegistry.OAK; + BlockEntity entity = world.getBlockEntity(pos); + if (entity instanceof LampBlockEntity) { + variant = ((LampBlockEntity) entity).getVariant(); + } + BitSet set = new BitSet(); + set.set(0, world.getBlockState(pos.up()).getBlock() instanceof BasicLampBlock); + set.set(1, world.getBlockState(pos.down()).getBlock() instanceof BasicLampBlock); + data.setData(CONNECTIONS, new ModelBitSetProperty(set)); + data.setData(VARIANT, variant); + return data; } - BitSet set = new BitSet(); - set.set(0, world.getBlockState(pos.up()).getBlock() instanceof BasicLampBlock); - set.set(1, world.getBlockState(pos.down()).getBlock() instanceof BasicLampBlock); - builder.withInitial(CONNECTIONS, new ModelBitSetProperty(set)); - builder.withInitial(VARIANT, variant); - return builder.build(); + return tileData; + } + + static List oakSprite = new ArrayList<>(); + static List getOakStrippedLogSprite() { + if (!oakSprite.isEmpty()) + return oakSprite; + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + oakSprite.add(wood); + return oakSprite; + } + + static Map> sprites = new HashMap<>(); + static List getVariantStrippedLogSprite(WoodVariant variant) { + if (sprites.containsKey(variant)) + return sprites.get(variant); + + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + List spriteList = new ArrayList<>(); + spriteList.add(wood); + sprites.put(variant, spriteList); + return spriteList; } @NotNull @Override public List getQuads(@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) { - List quads = new ArrayList<>(); if (state != null && extraData.getData(CONNECTIONS) != null && extraData.getData(CONNECTIONS).connections != null) { + List quads = new ArrayList<>(); int onOffset = state.get(Properties.LIT) ? 1 : 0; WoodVariant variant = extraData.getData(VARIANT); + Sprite sprite = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, variant.getTexture(BlockType.STRIPPED_LOG)).getSprite(); BitSet set = extraData.getData(CONNECTIONS).connections; if (set.get(0) && set.get(1)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(1)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(1).getQuads(state, side, rand, extraData)); } else if (set.get(0)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(0)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(0).getQuads(state, side, rand, extraData)); } else if (set.get(1)) { - quads.addAll(bakedModels.get(variant).get(modelParts.get(3)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(3).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(5+onOffset).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); } else { - quads.addAll(bakedModels.get(variant).get(modelParts.get(4)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(2)).getQuads(state, side, rand, extraData)); - quads.addAll(bakedModels.get(variant).get(modelParts.get(5+onOffset)).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(4).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(2).getQuads(state, side, rand, extraData)); + quads.addAll(getTemplateBakedModels().get(5+onOffset).getQuads(state, side, rand, extraData)); } + return getQuadsWithTexture(quads, getOakStrippedLogSprite(), getVariantStrippedLogSprite(variant)); } - return quads; + return Collections.emptyList(); } @Override @@ -92,12 +126,28 @@ public boolean isBuiltin() { } @Override - public Sprite getParticleSprite() { - return bakedModels.get(WoodVariantRegistry.OAK).get(modelParts.get(4)).getParticleSprite(); + public Sprite getParticleIcon(@NotNull IModelData data) { + if (data != null && data.hasProperty(VARIANT)) { + return getVariantStrippedLogSprite(data.getData(VARIANT)).get(0); + } + return super.getParticleIcon(data); } @Override public ModelTransformation getTransformation() { - return bakedModels.get(WoodVariantRegistry.OAK).get(modelParts.get(2)).getTransformation(); + return getTemplateBakedModels().get(2).getTransformation(); + } + + @Override + public List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + List quads = new ArrayList<>(); + WoodVariant variant = WoodVariantRegistry.OAK; + if (stack.hasNbt()) { + variant = WoodVariantRegistry.getVariant(Identifier.tryParse(stack.getSubNbt("BlockEntityTag").getString("variant"))); + } + quads.addAll(getTemplateBakedModels().get(4).getQuads(state, face, random)); + quads.addAll(getTemplateBakedModels().get(2).getQuads(state, face, random)); + quads.addAll(getTemplateBakedModels().get(5).getQuads(state, face, random)); + return getQuadsWithTexture(quads, getOakStrippedLogSprite(), getVariantStrippedLogSprite(variant)); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java index 7b0bc95a0..3412042b3 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/forge/UnbakedBasicLampModelImpl.java @@ -9,7 +9,7 @@ import java.util.Map; public class UnbakedBasicLampModelImpl { - public static BakedModel getBakedModel(Map textures, ModelBakeSettings settings, Map> variantToModelMap, List modelParts) { - return new ForgeBasicLampModel(textures, settings, variantToModelMap, modelParts); + public static BakedModel getBakedModel(ModelBakeSettings settings, List modelParts) { + return new ForgeBasicLampModel(settings, modelParts); } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index 07a9190f8..6852ce7df 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -47,8 +47,8 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos Map> separatedQuads = new ConcurrentHashMap<>(); public List getQuadsWithTexture(List quads, List toReplace, List replacements) { - if (toReplace.size() != replacements.size()) { - PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list is not the same size, skipping transformation"); + if (replacements == null || toReplace == null || toReplace.size() != replacements.size()) { + PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list is not the same size or was null, skipping transformation"); return quads; } if (toReplace.equals(replacements)) 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 914033141..23ca4a6ce 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 @@ -172,7 +172,7 @@ else if (ModelHelper.containsIdentifier(UnbakedFreezerModel.FREEZER_MODEL_IDS.to this.modelsToBake.put(resourceId, model); ci.cancel(); } - else if (ModelHelper.containsIdentifier(UnbakedBasicLampModel.LAMP_MODEL_IDS.toArray(new Identifier[0]), modifiedId)){ + else if (UnbakedBasicLampModel.LAMP_MODEL_IDS.contains(modifiedId)){ UnbakedModel model = new UnbakedBasicLampModel(); this.unbakedModels.put(resourceId, model); this.modelsToBake.put(resourceId, model); From 3b3a3af721c0ed61a15bab8e1c7ec8dd2037ee1f Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sun, 24 Dec 2023 13:21:05 -0600 Subject: [PATCH 07/10] fix lamps not having the correct particles on fabric --- .../models/basicLamp/fabric/FabricBasicLampModel.java | 11 +++++++++++ .../pfm/blocks/models/fabric/PFMFabricBakedModel.java | 8 ++++++++ .../client/fabric/PFMBakedModelParticleExtension.java | 4 ++++ .../pfm/mixin/fabric/PFMCrackParticleMixin.java | 3 ++- 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java index 96d43f404..9a7518f6e 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/basicLamp/fabric/FabricBasicLampModel.java @@ -22,6 +22,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; +import net.minecraft.world.World; import java.util.*; import java.util.function.Supplier; @@ -108,4 +109,14 @@ static List getVariantStrippedLogSprite(WoodVariant variant) { public Sprite pfm$getParticle(BlockState state) { return getTemplateBakedModels().get(4).getParticleSprite(); } + + @Override + public Sprite pfm$getParticle(World world, BlockPos pos, BlockState state) { + BlockEntity entity = world.getBlockEntity(pos); + WoodVariant variant = WoodVariantRegistry.OAK; + if (world.getBlockEntity(pos) instanceof LampBlockEntity) { + variant = ((LampBlockEntity) entity).getVariant(); + } + return getVariantStrippedLogSprite(variant).get(0); + } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java index 0d621f44a..33c500e4c 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/blocks/models/fabric/PFMFabricBakedModel.java @@ -5,12 +5,15 @@ import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel; import net.fabricmc.fabric.api.renderer.v1.model.SpriteFinder; import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; +import net.minecraft.block.BlockState; import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.render.model.ModelBakeSettings; import net.minecraft.client.texture.Sprite; import net.minecraft.screen.PlayerScreenHandler; import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; import java.util.List; import java.util.Map; @@ -61,6 +64,11 @@ public void pushTextureTransform(RenderContext context, List toReplace, } + @Override + public Sprite pfm$getParticle(World world, BlockPos pos, BlockState state) { + return pfm$getParticle(state); + } + @Override public Sprite getParticleSprite() { return getTemplateBakedModels().get(0).getParticleSprite(); diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java index 255d5ec1e..f86dde4aa 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/client/fabric/PFMBakedModelParticleExtension.java @@ -2,7 +2,11 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; public interface PFMBakedModelParticleExtension { Sprite pfm$getParticle(BlockState state); + + Sprite pfm$getParticle(World world, BlockPos pos, BlockState state); } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java index 2d4ee687a..a527fcd04 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMCrackParticleMixin.java @@ -9,6 +9,7 @@ import net.minecraft.client.world.ClientWorld; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -26,7 +27,7 @@ public void setCustomModelParticle(ClientWorld world, double x, double y, double BlockState defaultState = ((BlockItem)stack.getItem()).getBlock().getDefaultState(); BakedModel model = MinecraftClient.getInstance().getBakedModelManager().getBlockModels().getModel(defaultState); if (model instanceof PFMBakedModelParticleExtension) { - this.setSprite(((PFMBakedModelParticleExtension) model).pfm$getParticle(defaultState)); + this.setSprite(((PFMBakedModelParticleExtension) model).pfm$getParticle(world, new BlockPos(x, y, z), defaultState)); } } } From 7ad09620236af4b98d8e66115cb7cb68b1e80ab4 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:20:55 -0600 Subject: [PATCH 08/10] oops --- .../pfm/blocks/blockentities/BathtubBlockEntity.java | 4 +--- .../pfm/blocks/blockentities/PFMBedBlockEntity.java | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/BathtubBlockEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/BathtubBlockEntity.java index 69d2bad59..225075635 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/BathtubBlockEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/BathtubBlockEntity.java @@ -17,15 +17,13 @@ import net.minecraft.world.World; public class BathtubBlockEntity extends BedBlockEntity { - private final BlockEntityType type; public BathtubBlockEntity(BlockPos pos, BlockState state) { super(pos, state, DyeColor.WHITE); - this.type = BlockEntities.BATHTUB_BLOCK_ENTITY; } @Override public BlockEntityType getType() { - return type; + return BlockEntities.BATHTUB_BLOCK_ENTITY; } private int fillTimer = 0; diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java index 42f1ac809..be958cf38 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/blockentities/PFMBedBlockEntity.java @@ -10,15 +10,12 @@ import net.minecraft.util.math.BlockPos; public class PFMBedBlockEntity extends BedBlockEntity implements DyeableFurnitureBlockEntity { - private final BlockEntityType type; public PFMBedBlockEntity(BlockPos pos, BlockState state, DyeColor color) { super(pos, state, color); - type = BlockEntities.BED_BLOCK_ENTITY; } public PFMBedBlockEntity(BlockPos pos, BlockState state) { super(pos, state); - type = BlockEntities.BED_BLOCK_ENTITY; } @Override @@ -44,6 +41,6 @@ public PFMBedBlockEntity getEntity() { @Override public BlockEntityType getType() { - return type; + return BlockEntities.BED_BLOCK_ENTITY; } } From 5d25a5667543fa14cad412dfed13efea9c246a4d Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sun, 24 Dec 2023 14:24:52 -0600 Subject: [PATCH 09/10] fix weird item group crash --- .../unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java | 3 ++- .../pfm/registry/forge/ItemGroupRegistryForge.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java index 4a099b015..87d0bfda7 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/fabric/PaladinFurnitureModFabric.java @@ -9,6 +9,7 @@ import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig; import com.unlikepaladin.pfm.config.option.AbstractConfigOption; import com.unlikepaladin.pfm.data.materials.DynamicBlockRegistry; +import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import com.unlikepaladin.pfm.mixin.PFMMixinPointOfInterestTypeFactory; import com.unlikepaladin.pfm.registry.*; import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry; @@ -119,7 +120,7 @@ public static void onServerJoin(ServerPlayNetworkHandler handler, PacketSender s public static void initializeItemGroup() { PaladinFurnitureMod.FURNITURE_GROUP = FabricItemGroupBuilder.build( new Identifier(MOD_ID, "furniture"), - () -> PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getFromVanillaWoodType(BoatEntity.Type.OAK, true).asItem().getDefaultStack()); + () -> PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMap().get(WoodVariantRegistry.OAK).asItem().getDefaultStack()); } public static void replaceHomePOI() { diff --git a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/ItemGroupRegistryForge.java b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/ItemGroupRegistryForge.java index e4e338514..026a4ca82 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/ItemGroupRegistryForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/registry/forge/ItemGroupRegistryForge.java @@ -3,6 +3,8 @@ import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.BasicChairBlock; +import com.unlikepaladin.pfm.data.materials.WoodVariant; +import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import com.unlikepaladin.pfm.registry.PaladinFurnitureModBlocksItems; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.item.ItemGroup; @@ -19,7 +21,7 @@ public static void registerItemGroups(){ PaladinFurnitureMod.FURNITURE_GROUP = new ItemGroup(MOD_ID + ".furniture") { @Override public ItemStack createIcon() { - return PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getFromVanillaWoodType(BoatEntity.Type.OAK, true).asItem().getDefaultStack(); + return PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).getVariantToBlockMap().get(WoodVariantRegistry.OAK).asItem().getDefaultStack(); } }; PaladinFurnitureMod.DYE_KITS = new ItemGroup(MOD_ID + ".dye_kits") { From a1672b527c74d152f3e6dd32a8ec8ec59ca43561 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sun, 24 Dec 2023 15:06:14 -0600 Subject: [PATCH 10/10] yeah --- .../pfm/blocks/models/forge/PFMForgeBakedModel.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java index 6852ce7df..4ea85c8c8 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/blocks/models/forge/PFMForgeBakedModel.java @@ -45,7 +45,7 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos return tileData; } - Map> separatedQuads = new ConcurrentHashMap<>(); + Map> separatedQuads = new ConcurrentHashMap<>(); public List getQuadsWithTexture(List quads, List toReplace, List replacements) { if (replacements == null || toReplace == null || toReplace.size() != replacements.size()) { PaladinFurnitureMod.GENERAL_LOGGER.warn("Replacement list is not the same size or was null, skipping transformation"); @@ -55,7 +55,7 @@ public List getQuadsWithTexture(List quads, List t return quads; for (BakedQuad quad : quads) { - Sprite sprite = quad.getSprite(); + Identifier sprite = quad.getSprite().getId(); if (separatedQuads.containsKey(sprite)) { if (!separatedQuads.get(sprite).contains(quad)) separatedQuads.get(sprite).add(quad); @@ -66,8 +66,8 @@ public List getQuadsWithTexture(List quads, List t } List transformedQuads = new ArrayList<>(quads.size()); - for (Map.Entry> entry : separatedQuads.entrySet()) { - Identifier keyId = entry.getKey().getId(); + for (Map.Entry> entry : separatedQuads.entrySet()) { + Identifier keyId = entry.getKey(); int index = IntStream.range(0, toReplace.size()) .filter(i -> keyId.equals(toReplace.get(i).getId())) .findFirst() @@ -120,7 +120,7 @@ else if (quadToTransformedQuad.containsKey(quadKey)) { return transformedQuads; } - private static final Map, Integer> ELEMENT_INTEGER_MAP = new HashMap<>(); + private static final Map, Integer> ELEMENT_INTEGER_MAP = new ConcurrentHashMap<>(); public static int findVertexElement(VertexFormatElement.Type type, int index) { Pair pairToFind = new Pair<>(type, index); if (ELEMENT_INTEGER_MAP.containsKey(pairToFind))