Skip to content

Commit

Permalink
Merge branch 'refs/heads/architectury-1.20.6' into architectury-1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed Nov 25, 2024
2 parents fad934d + c968ffe commit 74ac91d
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,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 @@ -57,14 +53,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 @@ -44,11 +44,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
BlockSoundGroup soundGroup = state.getSoundGroup();
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 @@ -4,6 +4,7 @@
import com.unlikepaladin.pfm.advancements.PFMCriteria;
import com.unlikepaladin.pfm.advancements.fabric.CriteriaRegistryFabric;
import com.unlikepaladin.pfm.blocks.BasicChairBlock;
import com.unlikepaladin.pfm.compat.cookingforblockheads.fabric.PFMCookingForBlockHeadsCompat;
import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig;
import com.unlikepaladin.pfm.config.option.AbstractConfigOption;
import com.unlikepaladin.pfm.data.materials.DynamicBlockRegistry;
Expand All @@ -23,6 +24,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.network.RegistryByteBuf;
import net.minecraft.registry.*;
import net.minecraft.registry.Registry;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.sound.SoundEvent;
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 Expand Up @@ -35,13 +36,13 @@ public static BlockColorProvider getBlockColor(Block block) {
if (BLOCK_COLOR_PROVIDER_MAP.containsKey(block)) {
return BLOCK_COLOR_PROVIDER_MAP.get(block);
}
return ((BlockColorsExtension) blockColors).getColorMap().get(block.getRegistryEntry());
return ((BlockColorsExtension) blockColors).getColorMap().get(ForgeRegistries.BLOCKS.getDelegateOrThrow(block));
}

public static ItemColorProvider getItemColor(Item item) {
if (ITEM_COLOR_PROVIDER_MAP.containsKey(item)) {
return ITEM_COLOR_PROVIDER_MAP.get(item);
}
return ((ItemColorsExtension) itemColors).getColorMap().get(item.getRegistryEntry());
return ((ItemColorsExtension) itemColors).getColorMap().get(ForgeRegistries.ITEMS.getDelegateOrThrow(item));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.common.base.Suppliers;
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.data.forge.PFMTagsImpl;
import com.unlikepaladin.pfm.items.forge.PFMComponentsImpl;
Expand All @@ -14,18 +15,15 @@
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.resource.*;
import net.minecraft.resource.featuretoggle.FeatureFlags;
import net.minecraft.resource.featuretoggle.FeatureSet;
import net.minecraft.util.Identifier;
import com.unlikepaladin.pfm.runtime.PFMDataGenerator;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import com.unlikepaladin.pfm.runtime.PFMRuntimeResources;
import net.minecraft.SharedConstants;
import net.minecraft.resource.metadata.PackResourceMetadata;
import net.minecraft.text.Text;
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 @@ -58,6 +56,8 @@ public PaladinFurnitureModForge(FMLJavaModLoadingContext loadContext) {
MinecraftForge.EVENT_BUS.register(SoundRegistryForge.class);
MinecraftForge.EVENT_BUS.register(NetworkRegistryForge.class);
MinecraftForge.EVENT_BUS.register(PFMComponentsImpl.class);
loadContext.getModEventBus().addListener(EventPriority.LOW, ColorRegistryForge::registerBlockColors);
loadContext.getModEventBus().addListener(EventPriority.LOWEST, ColorRegistryForge::registerItemColors);
NetworkRegistryForge.registerPackets();
LateBlockRegistryForge.addDynamicBlockRegistration(loadContext);
PaladinFurnitureMod.isClient = FMLEnvironment.dist == Dist.CLIENT;
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.21.1
enabled_platforms=fabric,forge,neoforge

archives_base_name=paladin-furniture-mod
mod_version=1.3-beta.1
mod_version=1.3-rc.1
maven_group=com.unlikepaladin

architectury_version=13.0.6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@
import com.unlikepaladin.pfm.client.ColorRegistry;
import net.minecraft.client.render.RenderLayers;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;

@EventBusSubscriber(modid = "pfm", bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ColorRegistryNeoForge {
@SubscribeEvent
public static void registerBlockColors(RegisterColorHandlersEvent.Block 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 @@ -3,6 +3,7 @@
import com.google.common.base.Suppliers;
import com.unlikepaladin.pfm.PaladinFurnitureMod;
import com.unlikepaladin.pfm.client.PathPackRPWrapper;
import com.unlikepaladin.pfm.client.neoforge.ColorRegistryNeoForge;
import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig;
import com.unlikepaladin.pfm.registry.dynamic.neoforge.LateBlockRegistryNeoForge;
import com.unlikepaladin.pfm.registry.neoforge.*;
Expand All @@ -16,6 +17,7 @@
import net.minecraft.resource.metadata.PackResourceMetadata;
import net.minecraft.text.Text;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.EventPriority;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
Expand Down Expand Up @@ -49,6 +51,8 @@ public PaladinFurnitureModNeoForge(IEventBus modEventBus) {
modEventBus.register(BlockEntityRegistryNeoForge.class);
modEventBus.register(SoundRegistryNeoForge.class);
modEventBus.addListener(NetworkRegistryNeoForge::register);
modEventBus.addListener(EventPriority.LOW, ColorRegistryNeoForge::registerBlockColors);
modEventBus.addListener(EventPriority.LOWEST, ColorRegistryNeoForge::registerItemColors);
LateBlockRegistryNeoForge.addDynamicBlockRegistration(modEventBus);
PaladinFurnitureMod.isClient = FMLEnvironment.dist == Dist.CLIENT;
NeoForge.EVENT_BUS.addListener(NetworkRegistryNeoForge::onServerJoin);
Expand Down

0 comments on commit 74ac91d

Please sign in to comment.