Skip to content

Commit

Permalink
Merge branch 'refs/heads/architectury-1.18.2' into architectury-1.19.2
Browse files Browse the repository at this point in the history
# Conflicts:
#	forge/src/main/java/com/unlikepaladin/pfm/client/forge/ColorRegistryForge.java
  • Loading branch information
UnlikePaladin committed Nov 22, 2024
2 parents a070965 + 53d749b commit 5376f7d
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
public class ColorRegistry {
public static void registerBlockColors(){
List<Block> 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) -> {
Expand All @@ -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);
}
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public Optional<StoneVariant> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5376f7d

Please sign in to comment.