From 3ddfca541b283032bf2a0672026be151c7bd248f Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:20:00 -0600 Subject: [PATCH 1/4] extra checks to avoid extshape variants and slabs on stones --- .../pfm/data/materials/StoneVariantRegistry.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java index b038a8d4b..805e9aec9 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/StoneVariantRegistry.java @@ -42,11 +42,11 @@ public Optional getVariantFromBlock(Block baseBlock, Identifier bl } String namespace = blockId.getNamespace(); if (!namespace.equals("cozy_home") && name != null && !namespace.equals("securitycraft") && - !namespace.equals("absentbydesign") && !namespace.equals("chipped")) { + !namespace.equals("absentbydesign") && !namespace.equals("chipped") && !namespace.equals("extshape")) { BlockState state = baseBlock.getDefaultState(); // 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)) { + if (state.getProperties().size() <= 2 && !(baseBlock instanceof SlabBlock) && !name.contains("slab")) { // needs to use wood sound type // if (state.getSoundType() == SoundType.WOOD) { //wood from tcon has diff sounds Material mat = state.getMaterial(); From a2dd4f636bc102148f926b9893b8fcab3777cd9c Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:35:23 -0600 Subject: [PATCH 2/4] Fix block colors not being found correctly on forge Fix sink not being colored correctly --- .../pfm/client/ColorRegistry.java | 36 ++++++++++++++----- .../block/kitchen_sink/kitchen_sink.json | 10 +++--- .../block/kitchen_sink/kitchen_sink_full.json | 2 +- .../pfm/client/forge/ColorRegistryForge.java | 8 +---- .../pfm/client/forge/ColorRegistryImpl.java | 1 + .../pfm/forge/PaladinFurnitureModForge.java | 5 +++ 6 files changed, 40 insertions(+), 22 deletions(-) diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/ColorRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/client/ColorRegistry.java index 2a84f7bf6..e3c570473 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/client/ColorRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/client/ColorRegistry.java @@ -27,10 +27,6 @@ public class ColorRegistry { public static void registerBlockColors(){ List sinks = new ArrayList<>(); - KitchenSinkBlock.streamStoneSinks().map(FurnitureBlock::getBlock).forEach(sinks::add); - KitchenSinkBlock.streamWoodSinks().map(FurnitureBlock::getBlock).forEach(sinks::add); - BasicSinkBlock.streamSinks().forEach(sinks::add); - sinks.forEach(block -> registerBlockColor(block, addWaterColor())); registerBlockColor(PaladinFurnitureModBlocksItems.BASIC_TOILET, addToiletColor()); registerBlockColor(PaladinFurnitureModBlocksItems.BASIC_BATHTUB, addWaterColor()); registerBlockColor(PaladinFurnitureModBlocksItems.BASIC_LAMP, (state, world, pos, tintIndex) -> { @@ -55,14 +51,36 @@ public static void registerBlockColors(){ PaladinFurnitureModBlocksItems.furnitureEntryMap.forEach((key, value) -> { value.getVariantToBlockMap().forEach((variantBase, block) -> { BlockColorProvider blockColorProvider = getBlockColor(variantBase.getBaseBlock()); - if (blockColorProvider != null) { - registerBlockColor(block, blockColorProvider); + if (key.isAssignableFrom(KitchenSinkBlock.class)) { + registerBlockColor(block, ((state, world, pos, tintIndex) -> { + if (tintIndex == 1) { + return addWaterColor().getColor(state, world, pos, tintIndex); + } else if (blockColorProvider == null) { + return 0xFFFFFFF; + } + return blockColorProvider.getColor(state, world, pos, tintIndex); + })); + } else { + if (blockColorProvider != null) { + registerBlockColor(block, blockColorProvider); + } } }); value.getVariantToBlockMapNonBase().forEach((variantBase, block) -> { - BlockColorProvider blockColorProvider = getBlockColor(variantBase.getSecondaryBlock()); - if (blockColorProvider != null) { - registerBlockColor(block, blockColorProvider); + BlockColorProvider blockColorProvider = getBlockColor(variantBase.getBaseBlock()); + if (key.isAssignableFrom(KitchenSinkBlock.class)) { + registerBlockColor(block, ((state, world, pos, tintIndex) -> { + if (tintIndex == 1) { + return addWaterColor().getColor(state, world, pos, tintIndex); + } else if (blockColorProvider == null) { + return 0xFFFFFFF; + } + return blockColorProvider.getColor(state, world, pos, tintIndex); + })); + } else { + if (blockColorProvider != null) { + registerBlockColor(block, blockColorProvider); + } } }); }); 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 36530d737..623266c26 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 @@ -224,11 +224,11 @@ "from": [14, 14, 0], "to": [16, 16, 16], "faces": { - "north": {"uv": [14, 0, 16, 2], "texture": "#legs", "cullface": "north"}, - "east": {"uv": [0, 0, 16, 2], "texture": "#legs", "cullface": "east"}, - "south": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "south"}, - "up": {"uv": [14, 0, 16, 16], "texture": "#legs", "cullface": "up"}, - "down": {"uv": [0, 0, 2, 16], "texture": "#legs"} + "north": {"uv": [14, 0, 16, 2], "texture": "#legs", "cullface": "north", "tintindex": 0}, + "east": {"uv": [0, 0, 16, 2], "texture": "#legs", "cullface": "east", "tintindex": 0}, + "south": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "south", "tintindex": 0}, + "up": {"uv": [14, 0, 16, 16], "texture": "#legs", "cullface": "up", "tintindex": 0}, + "down": {"uv": [0, 0, 2, 16], "texture": "#legs", "tintindex": 0} } } ], 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 ef55b6ae3..075456ad2 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 @@ -225,7 +225,7 @@ "from": [14, 14, 0], "to": [16, 16, 16], "faces": { - "north": {"uv": [14, 0, 16, 2], "texture": "#legs", "cullface": "north"}, + "north": {"uv": [14, 0, 16, 2], "texture": "#legs", "cullface": "north", "tintindex": 0}, "east": {"uv": [0, 0, 16, 2], "texture": "#legs", "cullface": "east", "tintindex": 0}, "south": {"uv": [0, 0, 2, 2], "texture": "#legs", "cullface": "south", "tintindex": 0}, "up": {"uv": [14, 0, 16, 16], "texture": "#legs", "cullface": "up", "tintindex": 0}, diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryForge.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryForge.java index d7158d84b..024effa33 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryForge.java @@ -2,20 +2,14 @@ import com.unlikepaladin.pfm.client.ColorRegistry; import net.minecraft.client.render.RenderLayers; -import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ColorHandlerEvent; -import net.minecraftforge.eventbus.api.SubscribeEvent; -import net.minecraftforge.fml.common.Mod; -@Mod.EventBusSubscriber(modid = "pfm", bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class ColorRegistryForge { - @SubscribeEvent - public static void registerBlockColors(ColorHandlerEvent.Block event){ + public static void registerBlockColors(ColorHandlerEvent.Item event){ ColorRegistryImpl.blockColors = event.getBlockColors(); ColorRegistry.registerBlockColors(); ColorRegistryImpl.BLOCK_COLOR_PROVIDER_MAP.forEach((block, blockColorProvider) -> event.getBlockColors().registerColorProvider(blockColorProvider, block)); } - @SubscribeEvent public static void registerItemColors(ColorHandlerEvent.Item event){ ColorRegistryImpl.itemColors = event.getItemColors(); ColorRegistry.registerItemColors(); diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryImpl.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryImpl.java index 63ab5d58b..babd01f01 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryImpl.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryImpl.java @@ -7,6 +7,7 @@ import net.minecraft.client.color.item.ItemColors; import net.minecraft.client.render.RenderLayer; import net.minecraft.item.Item; +import net.minecraftforge.registries.ForgeRegistries; import java.util.HashMap; import java.util.Map; 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 41e1ab4a4..2ee05246a 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java @@ -4,6 +4,7 @@ import com.mojang.bridge.game.PackType; import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.client.PathPackRPWrapper; +import com.unlikepaladin.pfm.client.forge.ColorRegistryForge; import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig; import com.unlikepaladin.pfm.registry.dynamic.forge.LateBlockRegistryForge; import com.unlikepaladin.pfm.registry.forge.*; @@ -20,6 +21,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.AddPackFindersEvent; +import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; @@ -50,11 +52,14 @@ public PaladinFurnitureModForge() { MinecraftForge.EVENT_BUS.register(BlockEntityRegistryForge.class); MinecraftForge.EVENT_BUS.register(SoundRegistryForge.class); MinecraftForge.EVENT_BUS.register(NetworkRegistryForge.class); + FMLJavaModLoadingContext.get().getModEventBus().addListener(EventPriority.LOW, ColorRegistryForge::registerBlockColors); + FMLJavaModLoadingContext.get().getModEventBus().addListener(EventPriority.LOWEST, ColorRegistryForge::registerItemColors); NetworkRegistryForge.registerPackets(); LateBlockRegistryForge.addDynamicBlockRegistration(Block.class); LateBlockRegistryForge.addDynamicBlockRegistration(Item.class); PaladinFurnitureMod.isClient = FMLEnvironment.dist == Dist.CLIENT; FMLJavaModLoadingContext.get().getModEventBus().addListener(PaladinFurnitureModForge::generateResources); + } @SubscribeEvent From 561e03ea234f25181cb853aeb1852992a3d808ce Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:41:05 -0600 Subject: [PATCH 3/4] Fix Gray fridge crashes, it was being registered for the gray mirror lol --- .../com/unlikepaladin/pfm/registry/BlockEntityRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0cd491683..8de7c059e 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/BlockEntityRegistry.java @@ -21,7 +21,7 @@ public static void registerBlockEntities() { storage9x3Blocks.addAll(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCabinetBlock.class).getAllBlocks()); storage9x3Blocks.addAll(PaladinFurnitureModBlocksItems.furnitureEntryMap.get(ClassicNightstandBlock.class).getAllBlocks()); BlockEntities.DRAWER_BLOCK_ENTITY = registerBlockEntity("drawer_block_entity", storage9x3Blocks.toArray(Block[]::new), GenericStorageBlockEntity9x3.getFactory()); - BlockEntities.FRIDGE_BLOCK_ENTITY = registerBlockEntity("fridge_block_entity", new Block[]{PaladinFurnitureModBlocksItems.WHITE_FRIDGE, PaladinFurnitureModBlocksItems.XBOX_FRIDGE, PaladinFurnitureModBlocksItems.GRAY_MIRROR, PaladinFurnitureModBlocksItems.IRON_FRIDGE}, FridgeBlockEntity.getFactory()); + BlockEntities.FRIDGE_BLOCK_ENTITY = registerBlockEntity("fridge_block_entity", new Block[]{PaladinFurnitureModBlocksItems.WHITE_FRIDGE, PaladinFurnitureModBlocksItems.XBOX_FRIDGE, PaladinFurnitureModBlocksItems.GRAY_FRIDGE, PaladinFurnitureModBlocksItems.IRON_FRIDGE}, FridgeBlockEntity.getFactory()); BlockEntities.FREEZER_BLOCK_ENTITY = registerBlockEntity("freezer_block_entity", new Block[]{PaladinFurnitureModBlocksItems.WHITE_FREEZER, PaladinFurnitureModBlocksItems.GRAY_FREEZER, PaladinFurnitureModBlocksItems.IRON_FREEZER}, FreezerBlockEntity.getFactory()); Block[] counterOvens = PaladinFurnitureModBlocksItems.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getAllBlocks().toArray(Block[]::new); BlockEntities.KITCHEN_COUNTER_OVEN_BLOCK_ENTITY = registerBlockEntity("kitchen_counter_oven_block_entity", counterOvens, KitchenCounterOvenBlock.getFactory()); From 1d26de6fb238f58a5929eea79085290d5f3b580e Mon Sep 17 00:00:00 2001 From: UnlikePaladin <36827970+UnlikePaladin@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:44:29 -0600 Subject: [PATCH 4/4] Bump to release candidate 1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 8a61b58b3..08d1fdffe 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.3-beta.1 +mod_version=1.3-rc.1 maven_group=com.unlikepaladin architectury_version=2.10.12