Skip to content

Commit

Permalink
Merge branch 'refs/heads/architectury-1.19.3' into architectury-1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
UnlikePaladin committed Nov 25, 2024
2 parents 13e6faf + f1dd614 commit 19a9b0f
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 52 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
@@ -1,12 +1,9 @@
package com.unlikepaladin.pfm.fabric;

import com.google.common.collect.ImmutableSet;
import com.mojang.serialization.Lifecycle;
import com.unlikepaladin.pfm.PaladinFurnitureMod;
import com.unlikepaladin.pfm.advancements.PFMCriteria;
import com.unlikepaladin.pfm.advancements.fabric.CriteriaRegistryFabric;
import com.unlikepaladin.pfm.blocks.BasicChairBlock;
import com.unlikepaladin.pfm.blocks.SimpleBedBlock;
import com.unlikepaladin.pfm.compat.cookingforblockheads.fabric.PFMCookingForBlockHeadsCompat;
import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig;
import com.unlikepaladin.pfm.config.option.AbstractConfigOption;
Expand All @@ -15,40 +12,26 @@
import com.unlikepaladin.pfm.registry.*;
import com.unlikepaladin.pfm.registry.dynamic.LateBlockRegistry;
import com.unlikepaladin.pfm.registry.fabric.*;
import com.unlikepaladin.pfm.runtime.PFMRuntimeResources;
import io.netty.buffer.Unpooled;
import net.fabricmc.api.DedicatedServerModInitializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.fabricmc.fabric.impl.itemgroup.FabricItemGroupBuilderImpl;
import net.fabricmc.fabric.impl.itemgroup.ItemGroupHelper;
import net.fabricmc.fabric.api.networking.v1.PacketSender;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketByteBuf;
import net.minecraft.registry.Registries;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.sound.SoundEvent;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.registry.MutableRegistry;
import net.minecraft.util.Pair;
import net.minecraft.registry.Registry;
import net.minecraft.registry.RegistryKey;
import net.minecraft.world.poi.PointOfInterestType;
import net.minecraft.world.poi.PointOfInterestTypes;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.Collection;
import java.util.ArrayList;

public class PaladinFurnitureModFabric extends PaladinFurnitureMod implements ModInitializer, DedicatedServerModInitializer {

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,19 +3,13 @@
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.registry.BlockItemRegistry;
import com.unlikepaladin.pfm.registry.dynamic.forge.LateBlockRegistryForge;
import com.unlikepaladin.pfm.registry.forge.*;
import net.minecraft.registry.tag.BlockTags;
import net.minecraft.resource.ResourceType;
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.ResourcePackProfile;
Expand All @@ -25,6 +19,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 @@ -54,12 +49,15 @@ 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(ItemGroupRegistryForge::registerItemGroups);
FMLJavaModLoadingContext.get().getModEventBus().addListener(ItemGroupRegistryForge::addToVanillaItemGroups);
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.4
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=7.1.86
Expand Down

0 comments on commit 19a9b0f

Please sign in to comment.