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 b4209670e..d76ec4da3 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(){ PaladinFurnitureMod.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/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(); 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 4693b7ab6..69405dd26 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(PaladinFurnitureMod.furnitureEntryMap.get(KitchenCabinetBlock.class).getAllBlocks()); storage9x3Blocks.addAll(PaladinFurnitureMod.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 = PaladinFurnitureMod.furnitureEntryMap.get(KitchenCounterOvenBlock.class).getAllBlocks().toArray(Block[]::new); BlockEntities.KITCHEN_COUNTER_OVEN_BLOCK_ENTITY = registerBlockEntity("kitchen_counter_oven_block_entity", counterOvens, KitchenCounterOvenBlock.getFactory()); 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 100755 --- 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 100755 --- 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 7add2a8e7..0b62b1c57 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.RegisterColorHandlersEvent; -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(RegisterColorHandlersEvent.Block event){ + public static void registerBlockColors(RegisterColorHandlersEvent.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(RegisterColorHandlersEvent.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 9a21e2948..39baf9f90 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 332812b2a..e4cfb9d20 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,10 +52,13 @@ 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(); PaladinFurnitureMod.isClient = FMLEnvironment.dist == Dist.CLIENT; FMLJavaModLoadingContext.get().getModEventBus().addListener(PaladinFurnitureModForge::generateResources); + } @SubscribeEvent diff --git a/gradle.properties b/gradle.properties index e9eaad45a..196ba0f00 100755 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ minecraft_version=1.19 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=5.14.84