From a4e5756420b2c992010520db52c3adacac5dea4b Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Fri, 4 Oct 2024 01:09:50 -0600 Subject: [PATCH 01/10] Also clear id cache just in case --- .../java/com/unlikepaladin/pfm/blocks/models/ModelHelper.java | 2 +- .../pfm/mixin/PFMReloadableResourceManagerImplMixin.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) 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 bb03f9a11..102c75e7e 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 @@ -156,7 +156,7 @@ public static Block getWoolColor(String string) { public static Identifier getTextureId(Block block) { return getTextureId(block, ""); } - private static final Map, Pair> blockToTextureMap = new HashMap<>(); + public static final Map, Pair> blockToTextureMap = new HashMap<>(); public static Identifier getTextureId(Block block, String postfix) { if (postfix.isEmpty()) postfix = null; diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java index adf198713..532c7b5b6 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java @@ -1,5 +1,6 @@ package com.unlikepaladin.pfm.mixin; +import com.unlikepaladin.pfm.blocks.models.ModelHelper; import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.resource.ReloadableResourceManagerImpl; @@ -17,6 +18,7 @@ public class PFMReloadableResourceManagerImplMixin { @ModifyVariable(at = @At(value = "HEAD"), method = "reload", argsOnly = true) private List createReload(List packs) { PFMRuntimeResources.modelCacheMap.clear(); + ModelHelper.blockToTextureMap.clear(); return packs; } } \ No newline at end of file From 5af40c74371b5c6f3242dbf0ed7b99f0b3ea634b Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:13:09 -0600 Subject: [PATCH 02/10] Actually fix texture issues with Resource Packs --- .../pfm/blocks/models/ModelHelper.java | 18 ++++++++--------- ...PFMReloadableResourceManagerImplMixin.java | 20 +++++++++++++------ 2 files changed, 23 insertions(+), 15 deletions(-) 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 102c75e7e..0b2b71b4d 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 @@ -30,29 +30,29 @@ import java.util.concurrent.atomic.AtomicBoolean; public class ModelHelper { - private static List OAK_SPRITES_PLANKS_TO_REPLACE = null; + public static List OAK_SPRITES_PLANKS_TO_REPLACE = null; public static List getOakPlankLogSprites() { if (OAK_SPRITES_PLANKS_TO_REPLACE == null) { - 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)); + SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/oak_planks")); + SpriteIdentifier logId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/oak_log")); OAK_SPRITES_PLANKS_TO_REPLACE = Arrays.asList(planksId.getSprite(), logId.getSprite()); } return OAK_SPRITES_PLANKS_TO_REPLACE; } - private static List OAK_SPRITES_BED_TO_REPLACE = null; + public static List OAK_SPRITES_BED_TO_REPLACE = null; public static List getOakBedSprites() { if (OAK_SPRITES_BED_TO_REPLACE == null) { - SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.PLANKS)); + SpriteIdentifier planksId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/oak_planks")); SpriteIdentifier bedId = TexturedRenderLayers.BED_TEXTURES[DyeColor.RED.getId()]; OAK_SPRITES_BED_TO_REPLACE = Arrays.asList(planksId.getSprite(), bedId.getSprite()); } return OAK_SPRITES_BED_TO_REPLACE; } - private static List OAK_SPRITES_LOG_TOP_TO_REPLACE = null; + public static List OAK_SPRITES_LOG_TOP_TO_REPLACE = null; public static List getOakLogLogTopSprites() { if (OAK_SPRITES_LOG_TOP_TO_REPLACE == null) { - 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)); + SpriteIdentifier logId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/oak_log")); + SpriteIdentifier logTopId = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/oak_log_top")); OAK_SPRITES_LOG_TOP_TO_REPLACE = Arrays.asList(logId.getSprite(), logTopId.getSprite()); } return OAK_SPRITES_LOG_TOP_TO_REPLACE; @@ -494,5 +494,5 @@ public String asString() { public String getFileType() { return fileType; } - }; + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java index 532c7b5b6..8f814dc79 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java @@ -1,24 +1,32 @@ package com.unlikepaladin.pfm.mixin; import com.unlikepaladin.pfm.blocks.models.ModelHelper; -import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.resource.ReloadableResourceManagerImpl; import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.ResourceReload; +import net.minecraft.util.Unit; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Executor; @Mixin(value = ReloadableResourceManagerImpl.class) public class PFMReloadableResourceManagerImplMixin { - @ModifyVariable(at = @At(value = "HEAD"), method = "reload", argsOnly = true) - private List createReload(List packs) { + @Inject(at = @At(value = "HEAD"), method = "reload") + private void createReload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture initialStage, List packs, CallbackInfoReturnable cir) { PFMRuntimeResources.modelCacheMap.clear(); ModelHelper.blockToTextureMap.clear(); - return packs; + if (ModelHelper.OAK_SPRITES_PLANKS_TO_REPLACE != null) + ModelHelper.OAK_SPRITES_PLANKS_TO_REPLACE.clear(); + if (ModelHelper.OAK_SPRITES_BED_TO_REPLACE != null) + ModelHelper.OAK_SPRITES_BED_TO_REPLACE.clear(); + if (ModelHelper.OAK_SPRITES_LOG_TOP_TO_REPLACE != null) + ModelHelper.OAK_SPRITES_LOG_TOP_TO_REPLACE.clear(); } } \ No newline at end of file From f06b2c4d8830c88200bd68bdaa79d003d8252b60 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 18:46:01 -0600 Subject: [PATCH 03/10] Fix a crash with valkyren skies. And fix a few blocks that did not override rotation correctly --- .../pfm/blocks/AbstractSinkBlock.java | 13 ++++++ .../pfm/blocks/BasicCoffeeTableBlock.java | 44 ++++++++++++------- .../pfm/blocks/BasicTableBlock.java | 42 +++++++++++------- .../HorizontalFacingBlockWithEntity.java | 4 +- .../pfm/blocks/InnerTrashcanBlock.java | 14 ++++-- .../pfm/blocks/PowerableBlock.java | 3 +- .../pfm/blocks/SimpleBedBlock.java | 14 ++++-- 7 files changed, 91 insertions(+), 43 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/AbstractSinkBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/AbstractSinkBlock.java index a0771b1a5..9e2920e95 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/AbstractSinkBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/AbstractSinkBlock.java @@ -21,6 +21,8 @@ import net.minecraft.state.property.IntProperty; import net.minecraft.state.property.Properties; import net.minecraft.util.ActionResult; +import net.minecraft.util.BlockMirror; +import net.minecraft.util.BlockRotation; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; @@ -35,6 +37,7 @@ import java.util.function.Predicate; import static com.unlikepaladin.pfm.blocks.BasicToiletBlock.checkType; +import static net.minecraft.block.HorizontalFacingBlock.FACING; public abstract class AbstractSinkBlock extends AbstractCauldronBlock implements BlockEntityProvider { public static final IntProperty LEVEL_4 = IntProperty.of("level", 0, 3); @@ -201,4 +204,14 @@ public void onEntityCollision(BlockState state, World world, BlockPos pos, Entit public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return false; } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(state.get(FACING))); + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicCoffeeTableBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicCoffeeTableBlock.java index f29519523..9cc04a995 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicCoffeeTableBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicCoffeeTableBlock.java @@ -9,6 +9,7 @@ import net.minecraft.state.StateManager; import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; +import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -24,6 +25,8 @@ import java.util.Map; import java.util.stream.Stream; +import static net.minecraft.block.HorizontalFacingBlock.FACING; + public class BasicCoffeeTableBlock extends Block { private final Block baseBlock; public static final EnumProperty AXIS = Properties.HORIZONTAL_AXIS; @@ -54,23 +57,7 @@ public static Stream streamStoneBasicTables() { protected void appendProperties(StateManager.Builder stateManager) { stateManager.add(AXIS); } - @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - switch (rotation) { - case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> { - switch (state.get(AXIS)) { - case X -> { - return state.with(AXIS, Direction.Axis.Z); - } - case Z -> { - return state.with(AXIS, Direction.Axis.X); - } - } - return state; - } - } - return state; - } + @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if (!state.isOf(state.getBlock())) { @@ -269,6 +256,29 @@ private static VoxelShape getShapeForAxis(Direction.Axis axis, VoxelShape a, Vox public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return false; } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + switch (rotation) { + case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> { + switch (state.get(AXIS)) { + case X -> { + return state.with(AXIS, Direction.Axis.Z); + } + case Z -> { + return state.with(AXIS, Direction.Axis.X); + } + } + return state; + } + } + return state; + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(Direction.get(Direction.AxisDirection.NEGATIVE, state.get(AXIS)))); + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicTableBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicTableBlock.java index 87b1af9d7..3fc82ec3e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicTableBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/BasicTableBlock.java @@ -9,6 +9,7 @@ import net.minecraft.state.StateManager; import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; +import net.minecraft.util.BlockMirror; import net.minecraft.util.BlockRotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -51,23 +52,7 @@ public static Stream streamStoneBasicTables() { protected void appendProperties(StateManager.Builder stateManager) { stateManager.add(AXIS); } - @Override - public BlockState rotate(BlockState state, BlockRotation rotation) { - switch (rotation) { - case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> { - switch (state.get(AXIS)) { - case X -> { - return state.with(AXIS, Direction.Axis.Z); - } - case Z -> { - return state.with(AXIS, Direction.Axis.X); - } - } - return state; - } - } - return state; - } + @Override public void onBlockAdded(BlockState state, World world, BlockPos pos, BlockState oldState, boolean notify) { if (!state.isOf(state.getBlock())) { @@ -266,6 +251,29 @@ private static VoxelShape getShapeForAxis(Direction.Axis axis, VoxelShape a, Vox public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type) { return false; } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + switch (rotation) { + case COUNTERCLOCKWISE_90, CLOCKWISE_90 -> { + switch (state.get(AXIS)) { + case X -> { + return state.with(AXIS, Direction.Axis.Z); + } + case Z -> { + return state.with(AXIS, Direction.Axis.X); + } + } + return state; + } + } + return state; + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(Direction.get(Direction.AxisDirection.NEGATIVE, state.get(AXIS)))); + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/HorizontalFacingBlockWithEntity.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/HorizontalFacingBlockWithEntity.java index 32f093788..39f57b6f9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/HorizontalFacingBlockWithEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/HorizontalFacingBlockWithEntity.java @@ -20,11 +20,11 @@ protected HorizontalFacingBlockWithEntity(AbstractBlock.Settings settings) { } public BlockState rotate(BlockState state, BlockRotation rotation) { - return (BlockState)state.with(FACING, rotation.rotate((Direction)state.get(FACING))); + return state.with(FACING, rotation.rotate(state.get(FACING))); } public BlockState mirror(BlockState state, BlockMirror mirror) { - return state.rotate(mirror.getRotation((Direction)state.get(FACING))); + return state.rotate(mirror.getRotation(state.get(FACING))); } static { diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/InnerTrashcanBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/InnerTrashcanBlock.java index 541890b22..ccfa029c0 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/InnerTrashcanBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/InnerTrashcanBlock.java @@ -13,9 +13,7 @@ import net.minecraft.state.property.BooleanProperty; import net.minecraft.state.property.DirectionProperty; import net.minecraft.state.property.Properties; -import net.minecraft.util.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.ItemScatterer; +import net.minecraft.util.*; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -128,4 +126,14 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt } super.onStateReplaced(state, world, pos, newState, moved); } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(state.get(FACING))); + } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/PowerableBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/PowerableBlock.java index 8b72c682a..05e782816 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/PowerableBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/PowerableBlock.java @@ -1,11 +1,12 @@ package com.unlikepaladin.pfm.blocks; +import net.minecraft.block.Block; import net.minecraft.block.HorizontalFacingBlock; import net.minecraft.state.property.BooleanProperty; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -public abstract class PowerableBlock extends HorizontalFacingBlock { +public abstract class PowerableBlock extends Block { protected PowerableBlock(Settings settings) { super(settings); } 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 e34ebc08a..5531804c2 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/SimpleBedBlock.java @@ -17,9 +17,7 @@ import net.minecraft.state.StateManager; import net.minecraft.tag.BlockTags; import net.minecraft.text.TranslatableText; -import net.minecraft.util.ActionResult; -import net.minecraft.util.DyeColor; -import net.minecraft.util.Hand; +import net.minecraft.util.*; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; @@ -218,4 +216,14 @@ public DyeColor getPFMColor() { public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { return new PFMBedBlockEntity(pos, state, this.color); } + + @Override + public BlockState rotate(BlockState state, BlockRotation rotation) { + return state.with(FACING, rotation.rotate(state.get(FACING))); + } + + @Override + public BlockState mirror(BlockState state, BlockMirror mirror) { + return state.rotate(mirror.getRotation(state.get(FACING))); + } } From 8ffbbd69341018936d9c256a9d39ee9ffcdd359f Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 19:40:39 -0600 Subject: [PATCH 04/10] Fix incorrect recipe for filler cabinets and kitchen cabinets --- .../pfm/mixin/PFMReloadableResourceManagerImplMixin.java | 6 +++--- .../unlikepaladin/pfm/runtime/data/PFMRecipeProvider.java | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java index 8f814dc79..8f20d0e11 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java @@ -23,10 +23,10 @@ private void createReload(Executor prepareExecutor, Executor applyExecutor, Comp PFMRuntimeResources.modelCacheMap.clear(); ModelHelper.blockToTextureMap.clear(); if (ModelHelper.OAK_SPRITES_PLANKS_TO_REPLACE != null) - ModelHelper.OAK_SPRITES_PLANKS_TO_REPLACE.clear(); + ModelHelper.OAK_SPRITES_PLANKS_TO_REPLACE = null; if (ModelHelper.OAK_SPRITES_BED_TO_REPLACE != null) - ModelHelper.OAK_SPRITES_BED_TO_REPLACE.clear(); + ModelHelper.OAK_SPRITES_BED_TO_REPLACE = null; if (ModelHelper.OAK_SPRITES_LOG_TOP_TO_REPLACE != null) - ModelHelper.OAK_SPRITES_LOG_TOP_TO_REPLACE.clear(); + ModelHelper.OAK_SPRITES_LOG_TOP_TO_REPLACE = null; } } \ No newline at end of file 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 29c971cb9..337d8f76c 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 @@ -443,7 +443,7 @@ protected void generateRecipes(Consumer exporter) { PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallCounterBlock.class).getVariantToBlockMap().forEach((variantBase, block) -> { if (!generatedRecipes.contains(getId(block))) { Pair materials = getCounterMaterials(variantBase); - offerCounterRecipe(block.asItem(), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(materials.getRight()), exporter); + offerCounterRecipe(block.asItem(), Ingredient.ofItems(materials.getLeft()), Ingredient.ofItems(materials.getLeft()), exporter); generatedRecipes.add(getId(block)); } }); @@ -456,20 +456,20 @@ protected void generateRecipes(Consumer exporter) { PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMap().forEach((variantBase, block) -> { if (!generatedRecipes.contains(getId(block))) { Pair materials = getCounterMaterials(variantBase); - offerWallDrawerRecipe(block.asItem(), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(Items.CHEST), exporter); + offerWallDrawerRecipe(block.asItem(), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(materials.getLeft()), Ingredient.ofItems(Items.CHEST), exporter); generatedRecipes.add(getId(block)); } }); PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerBlock.class).getVariantToBlockMapNonBase().forEach((variantBase, block) -> { if (!generatedRecipes.contains(getId(block))) { - offerWallDrawerRecipe(block.asItem(), Ingredient.ofItems((Block)variantBase.getChild("stripped_log")), Ingredient.ofItems((Block)variantBase.getChild("stripped_log")), Ingredient.ofItems(Items.CHEST), exporter); + offerWallDrawerRecipe(block.asItem(), Ingredient.ofItems((Block)variantBase.getChild("stripped_log")), Ingredient.ofItems(variantBase.getBaseBlock()), Ingredient.ofItems(Items.CHEST), exporter); generatedRecipes.add(getId(block)); } }); PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenWallDrawerSmallBlock.class).getVariantToBlockMap().forEach((variantBase, block) -> { if (!generatedRecipes.contains(getId(block))) { Pair materials = getCounterMaterials(variantBase); - offerWallDrawerSmallRecipe(block.asItem(), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(Items.CHEST), exporter); + offerWallDrawerSmallRecipe(block.asItem(), Ingredient.ofItems(materials.getRight()), Ingredient.ofItems(materials.getLeft()), Ingredient.ofItems(Items.CHEST), exporter); generatedRecipes.add(getId(block)); } }); From a5b415251d51ab2b30a12d991e2a5c161b20a2d2 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 20:09:39 -0600 Subject: [PATCH 05/10] Hardcode to the first 15 dyes to stop crashes from dye depot --- .../blocks/models/bed/UnbakedBedModel.java | 12 ++++++ .../registry/dynamic/LateBlockRegistry.java | 41 ++++++++++++++++--- .../pfm/runtime/assets/PFMLangProvider.java | 6 +++ .../pfm/runtime/data/PFMRecipeProvider.java | 7 +++- 4 files changed, 59 insertions(+), 7 deletions(-) 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 9b4a5ce14..44d3e35c8 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,6 +2,7 @@ import com.mojang.datafixers.util.Pair; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.blocks.ShowerTowelBlock; import com.unlikepaladin.pfm.data.materials.WoodVariant; import com.unlikepaladin.pfm.data.materials.WoodVariantRegistry; import com.unlikepaladin.pfm.runtime.PFMBakedModelContainer; @@ -9,12 +10,15 @@ import dev.architectury.injectables.annotations.ExpectPlatform; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.block.AbstractBlock; +import net.minecraft.block.Material; 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.sound.BlockSoundGroup; import net.minecraft.util.DyeColor; import net.minecraft.util.Identifier; import org.jetbrains.annotations.Nullable; @@ -58,13 +62,21 @@ public class UnbakedBedModel implements UnbakedModel { public static final List BED_MODEL_IDS = new ArrayList<>() { { for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + int i = 0; for (DyeColor dyeColor : DyeColor.values()) { + if (i > 15) + break; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_" + dyeColor.getName() + "_simple_bed")); + i++; } } for(WoodVariant variant : WoodVariantRegistry.getVariants()){ + int i = 0; for (DyeColor dyeColor : DyeColor.values()) { + if (i > 15) + break; add(new Identifier(PaladinFurnitureMod.MOD_ID, "item/" + variant.asString() + "_" + dyeColor.getName() + "_classic_bed")); + i++; } } add(BED_MODEL_ID); diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java index 85d4b956c..d81a2117d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java @@ -78,8 +78,12 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat this.addBlock(variant, LateBlockRegistry.registerLateBlock( variant.asString()+"_chair_classic", () -> new ClassicChairBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicChairDyeableBlock.class, new FurnitureEntry<>() {{ + int i = 0; for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; this.addBlock(registerLateBlock("oak_chair_classic_" + color.getName(), () -> new ClassicChairDyeableBlock(color, AbstractBlock.Settings.copy(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(BasicChairBlock.class).allBlocks.get(0))), true, PaladinFurnitureMod.FURNITURE_GROUP)); + i++; } }}); @@ -101,15 +105,24 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat this.addBlock(registerLateBlock("froggy_chair_yellow", () -> new FroggyChairBlock(AbstractBlock.Settings.copy(this.allBlocks.get(0)).mapColor(MapColor.YELLOW)), true, PaladinFurnitureMod.FURNITURE_GROUP)); }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(SimpleSofaBlock.class, new FurnitureEntry<>() {{ + int i = 0; for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; this.addBlock(registerLateBlock(color.getName() + "_simple_sofa", () -> new SimpleSofaBlock(color, AbstractBlock.Settings.of(Material.WOOL).strength(2.0f).resistance(2.0f).nonOpaque().sounds(BlockSoundGroup.WOOL).mapColor(color.getMapColor())), true, PaladinFurnitureMod.FURNITURE_GROUP)); - }}}); + i++; + } + }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ArmChairBlock.class, new FurnitureEntry<>() {{ this.addBlock(registerLateBlock("arm_chair_leather", () -> new ArmChairBlock(AbstractBlock.Settings.of(Material.ORGANIC_PRODUCT).strength(2.0f).resistance(2.0f).nonOpaque().sounds(BlockSoundGroup.WOOL)), true, PaladinFurnitureMod.FURNITURE_GROUP)); }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ArmChairColoredBlock.class, new FurnitureEntry<>() {{ + int i = 0; for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; this.addBlock(registerLateBlock(color.getName() + "_arm_chair", () -> new ArmChairColoredBlock(color, AbstractBlock.Settings.of(Material.WOOL).strength(2.0f).resistance(2.0f).nonOpaque().sounds(BlockSoundGroup.WOOL).mapColor(color.getMapColor())), true, PaladinFurnitureMod.FURNITURE_GROUP)); + i++; } }}); @@ -207,17 +220,29 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat }}}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(SimpleBedBlock.class, new FurnitureEntry<>() {{ for (WoodVariant variant : WoodVariantRegistry.getVariants()) { - for (DyeColor color : DyeColor.values()) { SimpleBedBlock block = LateBlockRegistry.registerLateBlock(variant.asString() + "_" + color.getName() + "_simple_bed", () -> new SimpleBedBlock(color, AbstractBlock.Settings.of(Material.WOOL, state -> state.get(BedBlock.PART) == BedPart.FOOT ? color.getMapColor() : MapColor.WHITE_GRAY).sounds(BlockSoundGroup.WOOD).strength(0.2f).nonOpaque()), 1, PaladinFurnitureMod.FURNITURE_GROUP); - this.addBlock(variant, block, true); + int i = 0; + for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; + SimpleBedBlock block = LateBlockRegistry.registerLateBlock(variant.asString() + "_" + color.getName() + "_simple_bed", () -> new SimpleBedBlock(color, AbstractBlock.Settings.of(Material.WOOL, state -> state.get(BedBlock.PART) == BedPart.FOOT ? color.getMapColor() : MapColor.WHITE_GRAY).sounds(BlockSoundGroup.WOOD).strength(0.2f).nonOpaque()), 1, PaladinFurnitureMod.FURNITURE_GROUP); this.addBlock(variant, block, true); PaladinFurnitureModBlocksItems.beds.add(block); - }}}}); + i++; + } + } + }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ClassicBedBlock.class, new FurnitureEntry<>() {{ for (WoodVariant variant : WoodVariantRegistry.getVariants()) { - for (DyeColor color : DyeColor.values()) { ClassicBedBlock block = LateBlockRegistry.registerLateBlock(variant.asString() + "_" + color.getName() + "_classic_bed", () -> new ClassicBedBlock(color, AbstractBlock.Settings.of(Material.WOOL, state -> state.get(BedBlock.PART) == BedPart.FOOT ? color.getMapColor() : MapColor.WHITE_GRAY).sounds(BlockSoundGroup.WOOD).strength(0.2f).nonOpaque()), 1, PaladinFurnitureMod.FURNITURE_GROUP); + int i = 0; + for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; + ClassicBedBlock block = LateBlockRegistry.registerLateBlock(variant.asString() + "_" + color.getName() + "_classic_bed", () -> new ClassicBedBlock(color, AbstractBlock.Settings.of(Material.WOOL, state -> state.get(BedBlock.PART) == BedPart.FOOT ? color.getMapColor() : MapColor.WHITE_GRAY).sounds(BlockSoundGroup.WOOD).strength(0.2f).nonOpaque()), 1, PaladinFurnitureMod.FURNITURE_GROUP); this.addBlock(variant, block, true); PaladinFurnitureModBlocksItems.beds.add(block); + i++; } - }}}); + } + }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(SimpleBunkLadderBlock.class, new FurnitureEntry<>() {{ for (WoodVariant variant : WoodVariantRegistry.getVariants()) { this.addBlock(variant, LateBlockRegistry.registerLateBlock(variant.asString()+"_simple_bunk_ladder", () -> new SimpleBunkLadderBlock(AbstractBlock.Settings.copy(variant.getBaseBlock()).nonOpaque()), true, PaladinFurnitureMod.FURNITURE_GROUP), true); @@ -388,8 +413,12 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat this.addBlock( LateBlockRegistry.registerLateBlock( "mesh_trashcan",() -> PaladinFurnitureModBlocksItems.MESH_TRASHCAN, true, PaladinFurnitureMod.FURNITURE_GROUP)); }}); PaladinFurnitureModBlocksItems.furnitureEntryMap.put(ShowerTowelBlock.class, new FurnitureEntry() {{ + int i = 0; for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; this.addBlock(registerLateBlock(color.getName() + "_shower_towel", () -> new ShowerTowelBlock(color, AbstractBlock.Settings.of(Material.WOOL).strength(2.0f).resistance(2.0f).nonOpaque().sounds(BlockSoundGroup.WOOL).mapColor(color.getMapColor())), true, PaladinFurnitureMod.FURNITURE_GROUP)); + i++; } }}); if (!BlockItemRegistry.isModLoaded("imm_ptl_core")) { 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 e0c7924c4..33967df1d 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 @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; +import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.*; import com.unlikepaladin.pfm.data.materials.VariantBase; import com.unlikepaladin.pfm.data.materials.WoodVariant; @@ -21,6 +22,7 @@ import net.minecraft.client.resource.metadata.LanguageResourceMetadata; import net.minecraft.resource.*; import net.minecraft.util.DyeColor; +import net.minecraft.util.Identifier; import net.minecraft.util.Language; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -218,7 +220,10 @@ public String translate(String key, Object ... args) { public void generateTranslationForLampBlock(BufferedWriter writer) { for (WoodVariant variant : WoodVariantRegistry.getVariants()) { + int i = 0; for (DyeColor color : DyeColor.values()) { + if (i > 15) + break; try { String translatedVariantName = getTranslatedVariantName(variant); String translatedColor = translate("color.minecraft."+color.getName()); @@ -229,6 +234,7 @@ public void generateTranslationForLampBlock(BufferedWriter writer) { getParent().getLogger().error("Writer exception: " + e); throw new RuntimeException(e); } + i++; } } } 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 337d8f76c..9aeb415d5 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 @@ -955,7 +955,12 @@ private static InventoryChangedCriterion.Conditions conditionsFromItemPredicates } private static String getItemPath(Ingredient item) { - return Registry.ITEM.getId(item.getMatchingStacks()[0].getItem()).getPath(); + ItemStack[] n = item.getMatchingStacks(); + if (n.length > 0) { + return Registry.ITEM.getId(n[0].getItem()).getPath(); + } else { + return item.toString(); + } } private static String getItemPath(ItemConvertible item) { return Registry.ITEM.getId(item.asItem()).getPath(); From 1ee7f5ccc5ec29621169d530081de1b63f2b20c0 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 21:17:06 -0600 Subject: [PATCH 06/10] Fix issues with missing textures on stovetop, fix Light Switch Block Entity not being removed when the block was removed --- .../unlikepaladin/pfm/blocks/LightSwitchBlock.java | 11 +++++++++++ .../block/kitchen_counter/kitchen_stovetop.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java b/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java index 08b3c05ec..c7e763a28 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java +++ b/common/src/main/java/com/unlikepaladin/pfm/blocks/LightSwitchBlock.java @@ -1,6 +1,7 @@ package com.unlikepaladin.pfm.blocks; import com.unlikepaladin.pfm.blocks.blockentities.LightSwitchBlockEntity; +import com.unlikepaladin.pfm.blocks.blockentities.StovetopBlockEntity; import net.minecraft.block.*; import net.minecraft.block.entity.BlockEntity; import net.minecraft.entity.LivingEntity; @@ -17,6 +18,7 @@ import net.minecraft.state.property.Properties; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; +import net.minecraft.util.ItemScatterer; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; @@ -167,6 +169,14 @@ public void onStateReplaced(BlockState state, World world, BlockPos pos, BlockSt if (state.get(POWERED)) { this.updateNeighbors(state, world, pos); } + + if (state.isOf(newState.getBlock())) { + return; + } + BlockEntity blockEntity = world.getBlockEntity(pos); + if (blockEntity instanceof LightSwitchBlockEntity lightSwitchBlockEntity) { + lightSwitchBlockEntity.markRemoved(); + } } private void updateNeighbors(BlockState state, World world, BlockPos pos) { @@ -192,4 +202,5 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) { protected static Direction getDirection(BlockState state) { return state.get(FACING); } + } diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json index 79a898fac..bcccd7ac4 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json @@ -21,7 +21,7 @@ "rotation": {"angle": 0, "axis": "y", "origin": [8, 0.75, 9]}, "faces": { "up": {"uv": [12.5, 0.25, 16, 3], "rotation": 180, "texture": "#6"}, - "down": {"uv": [6.5, 2, 8.5, 12.2], "rotation": 180, "texture": "#missing"} + "down": {"uv": [6.5, 2, 8.5, 12.2], "rotation": 180, "texture": "#6"} } }, { From dd1edfe24a0ffe9094e88843453ab433d95d59e0 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:22:39 -0600 Subject: [PATCH 07/10] Fix texture issues on Forge --- .../models/basicLamp/forge/ForgeBasicLampModel.java | 6 +++--- .../pfm/blocks/models/forge/PFMForgeBakedModel.java | 12 ++++++++++++ .../client/forge/PFMBakedModelGetQuadsExtension.java | 11 +---------- 3 files changed, 16 insertions(+), 13 deletions(-) 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 2f7cc4e1a..4a750cc54 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 @@ -74,13 +74,13 @@ public IModelData getModelData(@NotNull BlockRenderView world, @NotNull BlockPos static List getOakStrippedLogSprite() { if (!oakSprite.isEmpty()) return oakSprite; - Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/stripped_oak_log")).getSprite(); oakSprite.add(wood); return oakSprite; } - static Map> sprites = new HashMap<>(); - static List getVariantStrippedLogSprite(WoodVariant variant) { + Map> sprites = new HashMap<>(); + List getVariantStrippedLogSprite(WoodVariant variant) { if (sprites.containsKey(variant)) return sprites.get(variant); 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 293d8df0f..c904e97bd 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 @@ -34,6 +34,18 @@ public List getQuads(ItemStack stack, @Nullable BlockState state, @Nu return getQuads(state, face, random); } + Map, List> cache = new HashMap<>(); + @Override + public List getQuadsCached(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { + Pair directionPair = new Pair<>(stack, face); + if (cache.containsKey(directionPair)) + return cache.get(directionPair); + + List quads = getQuads(stack, state, face, random); + cache.put(directionPair, quads); + return quads; + } + public PFMForgeBakedModel(ModelBakeSettings settings, List templateBakedModels) { super(settings, templateBakedModels); } 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 index 7d57f3730..b5a07db3d 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PFMBakedModelGetQuadsExtension.java @@ -16,14 +16,5 @@ public interface PFMBakedModelGetQuadsExtension { List getQuads(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random); - Map, List> cache = new HashMap<>(); - default List getQuadsCached(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random) { - Pair directionPair = new Pair<>(stack, face); - if (cache.containsKey(directionPair)) - return cache.get(directionPair); - - List quads = getQuads(stack, state, face, random); - cache.put(directionPair, quads); - return quads; - } + List getQuadsCached(ItemStack stack, @Nullable BlockState state, @Nullable Direction face, Random random); } From 043dd10e4c144cd4cae0403ee0d4fd175d0a9070 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 22:23:08 -0600 Subject: [PATCH 08/10] Bump to 1.3-beta.1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index bc05510cd..6276f6a90 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.17.1 enabled_platforms=fabric,forge archives_base_name=paladin-furniture-mod -mod_version=1.2.1 +mod_version=1.3-beta.1 maven_group=com.unlikepaladin architectury_version=2.10.12 From 89624a1791ae033a09db5cf4eba0d17325a0f498 Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Sat, 5 Oct 2024 20:09:39 -0600 Subject: [PATCH 09/10] Fix a possible texture issue on the basic lamp model on fabric --- .../models/basicLamp/fabric/FabricBasicLampModel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 9a7518f6e..e09d3799c 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 @@ -88,13 +88,13 @@ public ModelTransformation getTransformation() { static List getOakStrippedLogSprite() { if (!oakSprite.isEmpty()) return oakSprite; - Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, WoodVariantRegistry.OAK.getTexture(BlockType.STRIPPED_LOG)).getSprite(); + Sprite wood = new SpriteIdentifier(PlayerScreenHandler.BLOCK_ATLAS_TEXTURE, new Identifier("minecraft:block/stripped_oak_log")).getSprite(); oakSprite.add(wood); return oakSprite; } - static Map> sprites = new HashMap<>(); - static List getVariantStrippedLogSprite(WoodVariant variant) { + Map> sprites = new HashMap<>(); + List getVariantStrippedLogSprite(WoodVariant variant) { if (sprites.containsKey(variant)) return sprites.get(variant); From e9da0c795350db1bb126be77966b1f85c283138c Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Mon, 7 Oct 2024 01:11:44 -0600 Subject: [PATCH 10/10] Fix missing textures, bump the fabric loader version --- .../assets/pfm/blockstates/kitchen_stovetop.json | 8 ++++---- .../models/block/kitchen_counter/kitchen_stovetop.json | 1 + fabric/build.gradle | 6 ++++++ forge/build.gradle | 4 ++++ gradle.properties | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/common/src/main/resources/assets/pfm/blockstates/kitchen_stovetop.json b/common/src/main/resources/assets/pfm/blockstates/kitchen_stovetop.json index 28572781f..e2d3d2256 100644 --- a/common/src/main/resources/assets/pfm/blockstates/kitchen_stovetop.json +++ b/common/src/main/resources/assets/pfm/blockstates/kitchen_stovetop.json @@ -1,9 +1,9 @@ {"variants": { - "facing=north":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":180,"uvlock":"true"}, - "facing=east":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":270,"uvlock":"true"}, - "facing=south":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":0,"uvlock":"true"}, - "facing=west":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":90,"uvlock":"true"} + "facing=north":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":180,"uvlock":"false"}, + "facing=east":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":270,"uvlock":"false"}, + "facing=south":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":0,"uvlock":"false"}, + "facing=west":{"model":"pfm:block/kitchen_counter/kitchen_stovetop","y":90,"uvlock":"false"} } diff --git a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json index bcccd7ac4..8627e2e3d 100644 --- a/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json +++ b/common/src/main/resources/assets/pfm/models/block/kitchen_counter/kitchen_stovetop.json @@ -2,6 +2,7 @@ "credit": "By UnlikePaladin", "texture_size": [64, 64], "textures": { + "particle": "pfm:block/iron_stove", "6": "pfm:block/iron_stove" }, "elements": [ diff --git a/fabric/build.gradle b/fabric/build.gradle index ffc5d7978..c05186a9f 100755 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -236,3 +236,9 @@ publishing { // Add repositories to publish to here. } } + +configurations.configureEach { + resolutionStrategy { + force("net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}") + } +} \ No newline at end of file diff --git a/forge/build.gradle b/forge/build.gradle index 6234679fa..1a517a484 100755 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -103,6 +103,10 @@ if (rootProject.rei_compatibility == "true"){ transitive(false) } } +} else { + dependencies { + modCompileOnly("me.shedaniel:RoughlyEnoughItems-forge:${rootProject.rei_version}") + } } diff --git a/gradle.properties b/gradle.properties index 6276f6a90..8a61b58b3 100755 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ maven_group=com.unlikepaladin architectury_version=2.10.12 -fabric_loader_version=0.14.9 +fabric_loader_version=0.16.5 fabric_api_version=0.46.1+1.17 yarn_mappings=1.17.1+build.65