diff --git a/README.md b/README.md index 8b1bc0f21..b828b4cd7 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,40 @@ -![Paladin's Furniture Mod Banner](https://github.com/UnlikePaladin/paladin-furniture-mod/blob/main/docs/banner.png?raw=true) +![Paladin's Furniture Mod Banner](./docs/banner.png?raw=true) + +

+ fabric + forge + quilt +

+ ## Description -A Brand-New Furniture mod for Modern Minecraft where things are functional! It contains over 1,000 New Pieces of Furniture that you can use to furnish your build, while being functional and nice to look at. Everything is craftable and obtainable in Survival so it's friendly, and nice to look at, it has Compatibility with Sandwichable, REI, EMI and Patchouli. The mod has been in development for roughly 1 year but I don't plan on stopping with new updates, adding new furniture and mod compat with other mods! +A Brand-New Furniture mod for Modern Minecraft where things are functional! It contains over 1,000 New Pieces of Furniture that you can use to furnish your build, while being functional and nice to look at. Everything is craftable and obtainable in Survival so it's friendly, and nice to look at, it has compatibility with Sandwichable, REI, JEI, EMI, Patchouli, CookingForBlockHeads, Farmer's Delight and features modded wood type support. The mod has been in development for roughly 2 years but I don't plan on stopping with new updates, adding new furniture and mod compat with other mods! ![A Kitchen](https://cdn.discordapp.com/attachments/930656475741814804/1010808630683115611/2022-08-18_23.34.12.png) ## Installation -You will need Fabric Loader 0.14.6 or newer installed in your game in order to load this mod. If you haven't installed Fabric mods before, you can find a variety of community guides for doing so [here](https://fabricmc.net/wiki/install). +You will need Fabric Loader, Quilt Loader, NeoForge or MinecraftForge installed in your game in order to load this mod. If you haven't installed mods before, you can find a variety of community guides for doing so [here for Fabric](https://fabricmc.net/wiki/install) and [here for Forge](https://www.wikihow.com/Install-Minecraft-Forge). + +You will also need Fabric API installed if you're playing on Fabric to use the mod, you can get it [here](https://modrinth.com/mod/fabric-api). If you're playing with Sodium installed you will need [Indium](https://modrinth.com/mod/indium). + +The mod is available for versions 1.16.5 through 1.20.2 find the links further below. + +I have a [Discord](https://discord.gg/zbMDUPB) server that you can join if you need help or support with the mod, or if you would like to give me any feedback, I also provide compiled builds for testing new features before they make their way into public releases in it, so join if you'd like to keep up with the latest developments. -You will also need Fabric API and Cloth Config installed to use the mod, you can get that [here](https://modrinth.com/mod/fabric-api) and [here](https://modrinth.com/mod/cloth-config). +## Links +[discord]: https://discord.com/api/guilds/695034549045952592/widget.png +[modrinth]: https://img.shields.io/badge/Modrinth-1bd96a?logo=modrinth&logoColor=ffffff +[curseforge]: https://img.shields.io/badge/CurseForge-f16436?logo=curseforge&logoColor=ffffff +[github]: https://img.shields.io/badge/GitHub-181717?logo=github +[kofi]: https://img.shields.io/badge/Ko--fi-00b9fe?logo=kofi&logoColor=ffffff +[mcforum]: https://img.shields.io/badge/Minecraft-Forum-white?style=flat&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8%2F9hAAAAAXNSR0IArs4c6QAAAUBJREFUOE9jZGBgYGRAA%2FFdKq4gIS5toe0g%2BtvVd54gemHZnd3oakGa4Qaga0RXjM0gsAGENOIzCGxA5lazP%2BiKiOFP9z7FQrYBT8%2B8YdpUf48JbIBfo9I%2FaRORf8TYClID0vzl%2BjeGfSteIAxA1ozLMJBGkDqQZhCAG9AY5%2FT3rPIDRpAEjyYXA7oBMBuRLdF4w%2Fdn2p5bbGAvgAyASR78dQ0crSCDkAHMVpBGmDhWA0CSnz9%2F%2Fg2iz7E%2FZgPRyJrACYyX%2F9%2B3zx%2BZ4AaUBJr%2B4OXlZYVphrFB%2FJfPnvyFaUDWDBLrWX%2BaA%2B4FkK3IGmHOBImDbMMWQ3AXgFKi0hW5HdgMgbkAZDiIDTPoq9s%2Fb1DegOcFWHKGGQRSiK4JJAbTCDMIJTOBBEEGiR4X3IzNAJCT8eZGZEmYQbDQxpVKAZ8ywSEpbPKhAAAAAElFTkSuQmCC&labelColor=52a435&color=52a435 +[pmc]: https://img.shields.io/badge/Planet-Minecraft-white?style=flat&logo=data%3Aimage%2Fpng%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAATlBMVEX%2F%2F%2F8BV6kBV6kAAAAqVAEqVAFXsQ8nju1uwxBXqv89ov9LqP9EgAH%2F%2F%2F8vXAExmPcNdNMulfQBJkdYrgEBTpYTLi8BJkcTLi8Odcw8Kh1AKvelAAAAGnRSTlMA%2FwAAAP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwD%2F%2F%2F%2F%2F%2F%2F%2F%2FAAD%2FAHaBDEMAAADwSURBVHgBrNAHloQgEEVRlGhW0sz%2BVzp8quEYJ7%2BOWNfIdjW1lrNjIrcDAu2UzCmkEa3Zt0EeGdQZ0%2Ff9MGg9pqQUe4B56gZwAqgCiD1IswlVgAD4CZgb0Lbt7gimACTlLAQeHy5gdwpqWZY1HUN%2BC5hXZToM6Sud4t9BTw2IwLgH%2FRcAo68BRjTetu1yDY%2FAWts0zrm0oRydpuvqZQiBRQCtIQzaA28rSLlb8MYYi02TVmmbKmFKILJ78H4E1vrcWKO1tV%2BCCADhc%2Bt6AYy%2FBMpMIo8VHR%2BgCo8w93VOAAL5XAZYMgK8RoehYtn4MUkA1WIkb6ajLTUAAAAASUVORK5CYII%3D&labelColor=6fa1ce&color=6fa1ce +### Social: [ ![discord] ](https://discord.gg/zbMDUPB) +### Download: [ ![modrinth] ](https://modrinth.com/mod/paladins-furniture) [ ![curseforge] ](https://www.curseforge.com/minecraft/mc-mods/paladins-furniture) [![pmc]](https://www.planetminecraft.com/mod/paladin-s-furniture-mod/) [ ![mcforum] ](https://www.curseforge.com/minecraft/mc-mods/paladins-furniture) +### Donate: [ ![kofi] ](https://ko-fi.com/unlikepaladin) -The mod is avaialbe for versions 1.16.5 through 1.19.2 and can be downloaded off of [CurseForge](https://www.curseforge.com/minecraft/mc-mods/paladins-furniture), [Modrinth](https://modrinth.com/mod/paladins-furniture), [PlanetMC](https://www.planetminecraft.com/mod/paladin-s-furniture-mod/) and the [Minecraft Forum](https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/minecraft-mods/3159314-paladins-furniture-mod). -I've made a [Discord](https://discord.gg/zbMDUPB), you can join to ask for help or support, or to give any feedback, I'll also be providing compiled builds for testing new features before they make their way into public releases. ## License diff --git a/common/src/main/java/com/unlikepaladin/pfm/client/PathPackRPWrapper.java b/common/src/main/java/com/unlikepaladin/pfm/client/PathPackRPWrapper.java new file mode 100644 index 000000000..08b149aed --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/client/PathPackRPWrapper.java @@ -0,0 +1,70 @@ +package com.unlikepaladin.pfm.client; + +import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.ResourceType; +import net.minecraft.resource.metadata.PackResourceMetadata; +import net.minecraft.resource.metadata.ResourceMetadataReader; +import net.minecraft.util.Identifier; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Collection; +import java.util.Set; +import java.util.function.Predicate; +import java.util.function.Supplier; + +public class PathPackRPWrapper implements ResourcePack { + private final Supplier delegate; + private final PackResourceMetadata packResourceMetadata; + + public PathPackRPWrapper(Supplier delegate, PackResourceMetadata packResourceMetadata) { + this.delegate = delegate; + this.packResourceMetadata = packResourceMetadata; + } + + @Nullable + @Override + public InputStream openRoot(String fileName) throws IOException { + return null; + } + + @Override + public InputStream open(ResourceType type, Identifier id) throws IOException { + return delegate.get().open(type, id); + } + + @Override + public Collection findResources(ResourceType type, String namespace, String prefix, Predicate allowedPathPredicate) { + return delegate.get().findResources(type, namespace, prefix, allowedPathPredicate); + } + + @Override + public boolean contains(ResourceType type, Identifier id) { + return delegate.get().contains(type, id); + } + + @Override + public Set getNamespaces(ResourceType type) { + return delegate.get().getNamespaces(type); + } + + @Nullable + @Override + public T parseMetadata(ResourceMetadataReader metaReader) throws IOException { + if (metaReader.getKey().equals("pack")) { + return (T) packResourceMetadata; + } + return null; + } + + @Override + public String getName() { + return "PFM-Runtime-RP"; + } + + @Override + public void close() { + delegate.get().close(); + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMMirrorBlockIP.java b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMMirrorBlockIP.java index 0ae23d72f..277ab608a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMMirrorBlockIP.java +++ b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/PFMMirrorBlockIP.java @@ -1,5 +1,6 @@ package com.unlikepaladin.pfm.compat.imm_ptl; +import com.unlikepaladin.pfm.PaladinFurnitureMod; import com.unlikepaladin.pfm.blocks.MirrorBlock; import com.unlikepaladin.pfm.compat.imm_ptl.entity.PFMMirrorEntity; import net.minecraft.block.BlockState; @@ -26,26 +27,30 @@ protected PFMMirrorBlockIP(Settings settings) { @Override public void onPlaced(World world, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack itemStack) { super.onPlaced(world, pos, state, placer, itemStack); - if (!world.isClient && world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos)).isEmpty()) { - PFMMirrorEntity.createMirror((ServerWorld) world, pos, state.get(FACING).getOpposite()); + if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn()) { + if (!world.isClient && world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos)).isEmpty()) { + PFMMirrorEntity.createMirror((ServerWorld) world, pos, state.get(FACING).getOpposite()); + } } } @Override public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { super.onBreak(world, pos, state, player); + if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn()) { List mirrorBlockEntities; - if (!world.isClient && !(mirrorBlockEntities = world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos))).isEmpty()) { - mirrorBlockEntities.forEach(pfmMirrorEntity -> { - pfmMirrorEntity.remove(Entity.RemovalReason.KILLED); - }); - world.updateNeighbors(pos, state.getBlock()); + if (!world.isClient && !(mirrorBlockEntities = world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(pos))).isEmpty()) { + mirrorBlockEntities.forEach(pfmMirrorEntity -> { + pfmMirrorEntity.remove(Entity.RemovalReason.KILLED); + }); + world.updateNeighbors(pos, state.getBlock()); + } } } @Override public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) { - if (!world.isClient()) { + if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsSpawn() && !world.isClient()) { List mirrorBlockEntities = new ArrayList<>(); if (canConnect(neighborState, state)) { mirrorBlockEntities.addAll(world.getNonSpectatingEntities(PFMMirrorEntity.class, new Box(neighborPos))); diff --git a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMImmersivePortalsClient.java b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMImmersivePortalsClient.java index d0db56a5d..3062b3540 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMImmersivePortalsClient.java +++ b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMImmersivePortalsClient.java @@ -18,6 +18,6 @@ public PFMModCompatibility getCompatiblity() { @Override public void registerEntityRenderer() { - EntityRenderRegistry.registerEntityRender(PFMImmersivePortals.MIRROR, PortalEntityRenderer::new); + EntityRenderRegistry.registerEntityRender(PFMImmersivePortals.MIRROR, PFMMirrorEntityRenderer::new); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMMirrorEntityRenderer.java b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMMirrorEntityRenderer.java new file mode 100644 index 000000000..18e988234 --- /dev/null +++ b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/client/PFMMirrorEntityRenderer.java @@ -0,0 +1,20 @@ +package com.unlikepaladin.pfm.compat.imm_ptl.client; + +import com.unlikepaladin.pfm.PaladinFurnitureMod; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.util.math.MatrixStack; +import qouteall.imm_ptl.core.portal.Portal; +import qouteall.imm_ptl.core.render.PortalEntityRenderer; + +public class PFMMirrorEntityRenderer extends PortalEntityRenderer { + public PFMMirrorEntityRenderer(EntityRendererFactory.Context context) { + super(context); + } + + @Override + public void render(Portal portal, float yaw, float tickDelta, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light) { + if (PaladinFurnitureMod.getPFMConfig().doImmersivePortalsMirrorsRender()) + super.render(portal, yaw, tickDelta, matrixStack, vertexConsumerProvider, light); + } +} diff --git a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/entity/PFMMirrorEntity.java b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/entity/PFMMirrorEntity.java index b9d7c6519..6a959999a 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/entity/PFMMirrorEntity.java +++ b/common/src/main/java/com/unlikepaladin/pfm/compat/imm_ptl/entity/PFMMirrorEntity.java @@ -172,7 +172,7 @@ public static PFMMirrorEntity createMirror( facing.getAxis() ) ); - pfmMirrorEntity.setPosition(pos.x, pos.y, pos.z); + pfmMirrorEntity.setPosition(pos); pfmMirrorEntity.setDestination(pos); pfmMirrorEntity.dimensionTo = world.getRegistryKey(); diff --git a/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java b/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java index ec6e8d993..b8ee0a38d 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java +++ b/common/src/main/java/com/unlikepaladin/pfm/config/PaladinFurnitureModConfig.java @@ -37,7 +37,9 @@ public PaladinFurnitureModConfig(Path propertiesPath) { tablesOfDifferentMaterialsConnect = new BooleanConfigOption(Text.translatable("pfm.option.tablesOfDifferentMaterialsConnect"), Text.translatable("pfm.option.tablesOfDifferentMaterialsConnect.tooltip"), GAMEPLAY_OPTIONS, false, Side.SERVER), differentMirrorsConnect = new BooleanConfigOption(Text.translatable("pfm.option.differentMirrorsConnect"), Text.translatable("pfm.option.differentMirrorsConnect.tooltip"), GAMEPLAY_OPTIONS, false, Side.SERVER), enableBook = new BooleanConfigOption(Text.translatable("pfm.option.enableBook"), Text.translatable("pfm.option.enableBook.tooltip"), GAMEPLAY_OPTIONS, true, Side.SERVER), - mobsSitOnChairs = new BooleanConfigOption(Text.translatable("pfm.option.mobsSitOnChairs"), Text.translatable("pfm.option.mobsSitOnChairs.tooltip"), GAMEPLAY_OPTIONS, true, Side.SERVER) + mobsSitOnChairs = new BooleanConfigOption(Text.translatable("pfm.option.mobsSitOnChairs"), Text.translatable("pfm.option.mobsSitOnChairs.tooltip"), GAMEPLAY_OPTIONS, true, Side.SERVER), + renderImmersivePortalsMirrors = new BooleanConfigOption(Text.translatable("pfm.option.renderImmersivePortalsMirrors"), Text.translatable("pfm.option.renderImmersivePortalsMirrors.tooltip"), GAMEPLAY_OPTIONS, true, Side.SERVER), + spawnImmersivePortalsMirror = new BooleanConfigOption(Text.translatable("pfm.option.spawnImmersivePortalsMirror"), Text.translatable("pfm.option.spawnImmersivePortalsMirror.tooltip"), GAMEPLAY_OPTIONS, true, Side.CLIENT) ); this.propertiesPath = propertiesPath; } @@ -97,6 +99,12 @@ public boolean doMobsSitOnChairs() { public boolean isShaderSolidFixOn() { return shaderSolidFix.getValue(); } + public boolean doImmersivePortalsMirrorsRender() { + return renderImmersivePortalsMirrors.getValue(); + } + public boolean doImmersivePortalsMirrorsSpawn() { + return spawnImmersivePortalsMirror.getValue(); + } private BooleanConfigOption checkForUpdates; @@ -114,6 +122,8 @@ public boolean isShaderSolidFixOn() { private BooleanConfigOption enableBook; private BooleanConfigOption mobsSitOnChairs; + private BooleanConfigOption renderImmersivePortalsMirrors; + private BooleanConfigOption spawnImmersivePortalsMirror; public Path getPath() { @@ -144,6 +154,8 @@ public void load() throws IOException { enableBook.setValue("true".equals(properties.getProperty("enableBook"))); differentMirrorsConnect.setValue(!"false".equals(properties.getProperty("differentMirrorsConnect"))); mobsSitOnChairs.setValue("true".equals(properties.getProperty("mobsSitOnChairs"))); + renderImmersivePortalsMirrors.setValue("true".equals(properties.getProperty("renderImmersivePortalsMirrors"))); + spawnImmersivePortalsMirror.setValue("true".equals(properties.getProperty("spawnImmersivePortalsMirror"))); for (String key : options.keySet()) { if (!properties.containsKey(key.replace("pfm.option.", ""))){ @@ -170,6 +182,8 @@ public void save() throws IOException { properties.setProperty("enableBook",enableBook.getValue() ? "true" : "false"); properties.setProperty("differentMirrorsConnect", differentMirrorsConnect.getValue() ? "true" : "false"); properties.setProperty("mobsSitOnChairs", mobsSitOnChairs.getValue() ? "true" : "false"); + properties.setProperty("renderImmersivePortalsMirrors", renderImmersivePortalsMirrors.getValue() ? "true" : "false"); + properties.setProperty("spawnImmersivePortalsMirror", spawnImmersivePortalsMirror.getValue() ? "true" : "false"); // NB: This uses ISO-8859-1 with unicode escapes as the encoding try (OutputStream os = Files.newOutputStream(propertiesPath)) { diff --git a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java index ebd700575..6fff2ac43 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/data/materials/DynamicBlockRegistry.java @@ -66,7 +66,14 @@ public static void compatInit() { embur.addChild("wood", "embur_pedu_top"); embur.addChild("stripped_wood", "stripped_embur_pedu_top"); addBlockTypeFinder(WoodVariant.class, embur); - + WoodVariant.Finder emburOld = WoodVariant.Finder.simple( + "byg", "embur", "embur_planks", "embur_pedu"); + emburOld.addChild("stripped_log", "stripped_embur_pedu"); + emburOld.addChild("wood", "embur_pedu_hyphae"); + emburOld.addChild("stripped_wood", "stripped_embur_pedu_hyphae"); + emburOld.addChild("fence", "embur_fence"); + emburOld.addChild("slab", "embur_slab"); + addBlockTypeFinder(WoodVariant.class, emburOld); //mcreator mod with typos... addBlockTypeFinder(WoodVariant.class, WoodVariant.Finder.simple( diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMSaveLoaderMixin.java b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMSaveLoaderMixin.java index a5f74af7d..e53eda0c3 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMSaveLoaderMixin.java +++ b/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMSaveLoaderMixin.java @@ -1,9 +1,15 @@ package com.unlikepaladin.pfm.mixin; +import com.google.common.base.Suppliers; +import com.mojang.bridge.game.PackType; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.SharedConstants; import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.metadata.PackResourceMetadata; import net.minecraft.server.SaveLoader; import net.minecraft.server.SaveLoading; +import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; @@ -16,13 +22,11 @@ public class PFMSaveLoaderMixin { @ModifyArg(method = "load", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/LifecycledResourceManagerImpl;(Lnet/minecraft/resource/ResourceType;Ljava/util/List;)V"), index = 1) private List createReload(List packs) { + PFMRuntimeResources.RESOURCE_PACK_LIST = packs; List resourcePacks = new ArrayList<>(packs); - if (PFMRuntimeResources.ready) { - PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks; - //PFMRuntimeResources.runAsyncResourceGen(); No async for anyone, too bad forge won't behave - PFMRuntimeResources.prepareAndRunResourceGen(false); - resourcePacks.add(PFMRuntimeResources.ASSETS_PACK); - } + PackResourceMetadata packResourceMetadata = new PackResourceMetadata(Text.literal("pfm-runtime-resources"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); + resourcePacks.add(new PathPackRPWrapper(Suppliers.memoize(() -> { + PFMRuntimeResources.prepareAndRunResourceGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata)); return resourcePacks; } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java b/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java index 353b19fc3..4ff6dd859 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java +++ b/common/src/main/java/com/unlikepaladin/pfm/recipes/FurnitureRecipe.java @@ -44,9 +44,6 @@ public DefaultedList getIngredients() { public boolean matches(PlayerInventory playerInventory, World world) { List ingredients = this.getIngredients(); BitSet hasIngredients = new BitSet(ingredients.size()); - if (this.output.getItem().equals(PaladinFurnitureModBlocksItems.GLASS_MODERN_PENDANT.asItem())) { - System.out.println("wtf"); - } HashMap containedItems = new HashMap<>(); for (int i = 0; i < ingredients.size(); i++) { Ingredient ingredient = ingredients.get(i); diff --git a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java index 328c5f708..815b292e8 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java +++ b/common/src/main/java/com/unlikepaladin/pfm/registry/dynamic/LateBlockRegistry.java @@ -331,6 +331,7 @@ public static void registerBlocks() throws InvocationTargetException, Instantiat PaladinFurnitureModBlocksItems.LIGHT_SWITCH_ITEM = new LightSwitchItem(PaladinFurnitureModBlocksItems.LIGHT_SWITCH, new Item.Settings().group(PaladinFurnitureMod.FURNITURE_GROUP)); PaladinFurnitureMod.furnitureEntryMap.put(LightSwitchBlock.class, new FurnitureEntry() {{ this.addBlock( LateBlockRegistry.registerLateBlock( "light_switch",() -> PaladinFurnitureModBlocksItems.LIGHT_SWITCH, false, PaladinFurnitureMod.FURNITURE_GROUP)); + PaladinFurnitureModBlocksItems.BLOCKS.add(PaladinFurnitureModBlocksItems.LIGHT_SWITCH); LateBlockRegistry.registerLateItem("light_switch",() -> PaladinFurnitureModBlocksItems.LIGHT_SWITCH_ITEM); }}); PaladinFurnitureMod.furnitureEntryMap.put(BasicToiletBlock.class, new FurnitureEntry() {{ diff --git a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java index e3974057b..dc2bebe13 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java +++ b/common/src/main/java/com/unlikepaladin/pfm/runtime/PFMDataGen.java @@ -17,6 +17,8 @@ import net.minecraft.SharedConstants; import net.minecraft.data.DataCache; import net.minecraft.data.DataProvider; +import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.ResourceType; import org.apache.commons.codec.digest.DigestUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -38,6 +40,13 @@ public PFMDataGen(Path output, boolean logOrDebug) { } public void run() throws IOException { if (!frozen) { + log("Packs:"); + for (ResourcePack pack : PFMRuntimeResources.RESOURCE_PACK_LIST) { + log("\tPack {}", pack.getName()); + for (String namespace : pack.getNamespaces(ResourceType.CLIENT_RESOURCES)) { + log("\t\tNamespace {}", namespace); + } + } running = true; frozen = true; Path modListPath = PFMRuntimeResources.getPFMDirectory().resolve("modsList"); diff --git a/common/src/main/resources/assets/pfm/icon.png b/common/src/main/resources/assets/pfm/icon.png index f99bda95a..ec3be490a 100755 Binary files a/common/src/main/resources/assets/pfm/icon.png and b/common/src/main/resources/assets/pfm/icon.png differ diff --git a/common/src/main/resources/assets/pfm/lang/en_us.json b/common/src/main/resources/assets/pfm/lang/en_us.json index fd2b6ab1e..533039b4e 100644 --- a/common/src/main/resources/assets/pfm/lang/en_us.json +++ b/common/src/main/resources/assets/pfm/lang/en_us.json @@ -1291,6 +1291,10 @@ "pfm.option.mobsSitOnChairs.tooltip": "If true non-player mobs will sit on chairs on contact.", "pfm.option.shaderSolidFix": "Translucent Shader Fix", "pfm.option.shaderSolidFix.tooltip": "Makes furniture with translucent parts opaque to prevent rendering issues with shaders like Seus if shaders are on. Works both with Optifine and Iris/Oculus.", + "pfm.option.spawnImmersivePortalsMirror": "Spawn Immersive Portals Mirrors", + "pfm.option.spawnImmersivePortalsMirror.tooltip": "If true the mod's mirrors work if immersive portals is present, if the server sets this to false, it won't work for the players.", + "pfm.option.renderImmersivePortalsMirror": "Immersive Portals Mirror Rendering", + "pfm.option.renderImmersivePortalsMirror.tooltip": "If true mirrors will render if immersive portals is installed.", "pfm.config.title": "Paladin's Furniture Mod Config", "pfm.option.resetAll": "Reset All Options", diff --git a/common/src/main/resources/pfm-common.mixins.json b/common/src/main/resources/pfm-common.mixins.json index a3931abb6..e82398036 100644 --- a/common/src/main/resources/pfm-common.mixins.json +++ b/common/src/main/resources/pfm-common.mixins.json @@ -6,7 +6,6 @@ "mixins": [ "PFMDataCache$CachedDataMixin", "PFMPlayerInventoryMixin", - "PFMReloadableResourceManagerImplMixin", "PFMSaveLoaderMixin", "PFMTextureKeyFactory" ], diff --git a/docs/banner.png b/docs/banner.png index a768fe3e6..a7cecd27c 100644 Binary files a/docs/banner.png and b/docs/banner.png differ diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMMinecraftServerMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMMinecraftServerMixin.java index b4dc2e8f9..6296f12ef 100644 --- a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMMinecraftServerMixin.java +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMMinecraftServerMixin.java @@ -1,9 +1,15 @@ package com.unlikepaladin.pfm.mixin.fabric; +import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; +import com.mojang.bridge.game.PackType; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.SharedConstants; import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.metadata.PackResourceMetadata; import net.minecraft.server.MinecraftServer; +import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -19,15 +25,13 @@ @Mixin(MinecraftServer.class) public class PFMMinecraftServerMixin { - @Inject(method = "method_29442", at = @At(value = "RETURN"), cancellable = true) + @Inject(method = "method_29442", at = @At(value = "RETURN"), cancellable = true, remap = false) private void createReload(CallbackInfoReturnable> cir) { + PFMRuntimeResources.RESOURCE_PACK_LIST = new ArrayList<>(cir.getReturnValue()); List resourcePacks = new ArrayList<>(cir.getReturnValue()); - if (PFMRuntimeResources.ready) { - PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks; - //PFMRuntimeResources.runAsyncResourceGen(); No async for anyone, too bad forge won't behave - PFMRuntimeResources.prepareAndRunResourceGen(false); - resourcePacks.add(PFMRuntimeResources.ASSETS_PACK); - } + PackResourceMetadata packResourceMetadata = new PackResourceMetadata(Text.literal("pfm-runtime-resources"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); + resourcePacks.add(new PathPackRPWrapper(Suppliers.memoize(() -> { + PFMRuntimeResources.prepareAndRunResourceGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata)); cir.setReturnValue(ImmutableList.copyOf(resourcePacks)); } } diff --git a/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMReloadableResourceManagerImplMixin.java b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMReloadableResourceManagerImplMixin.java new file mode 100644 index 000000000..fc5f7cb2b --- /dev/null +++ b/fabric/src/main/java/com/unlikepaladin/pfm/mixin/fabric/PFMReloadableResourceManagerImplMixin.java @@ -0,0 +1,31 @@ +package com.unlikepaladin.pfm.mixin.fabric; + +import com.google.common.base.Suppliers; +import com.mojang.bridge.game.PackType; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.SharedConstants; +import net.minecraft.resource.ReloadableResourceManagerImpl; +import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.metadata.PackResourceMetadata; +import net.minecraft.text.Text; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import java.util.ArrayList; +import java.util.List; + +@Mixin(value = ReloadableResourceManagerImpl.class) +public class PFMReloadableResourceManagerImplMixin { + + @ModifyVariable(at = @At(value = "HEAD"), method = "reload", argsOnly = true) + private List createReload(List packs) { + PFMRuntimeResources.RESOURCE_PACK_LIST = packs; + List resourcePacks = new ArrayList<>(packs); + PackResourceMetadata packResourceMetadata = new PackResourceMetadata(Text.literal("pfm-runtime-resources"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); + resourcePacks.add(new PathPackRPWrapper(Suppliers.memoize(() -> { + PFMRuntimeResources.prepareAndRunResourceGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata)); + return resourcePacks; + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/pfm.mixins.json b/fabric/src/main/resources/pfm.mixins.json index 025c1c04c..dad4cdaf5 100755 --- a/fabric/src/main/resources/pfm.mixins.json +++ b/fabric/src/main/resources/pfm.mixins.json @@ -9,7 +9,8 @@ "PFMAbstractTagProvider$ObjectBuilderMixin", "PFMCookingPotBlockEntityMixin", "PFMMinecraftServerMixin", - "PFMMixinPointOfInterestType" + "PFMMixinPointOfInterestType", + "PFMReloadableResourceManagerImplMixin" ], "injectors": { "defaultRequire": 1 diff --git a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java index 60cbd0bf2..ff01380cb 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/client/forge/PaladinFurnitureModClientForge.java @@ -21,7 +21,6 @@ import com.unlikepaladin.pfm.client.PaladinFurnitureModClient; import com.unlikepaladin.pfm.client.ScreenRegistry; import com.unlikepaladin.pfm.client.screens.*; -import com.unlikepaladin.pfm.registry.forge.NetworkRegistryForge; import net.minecraft.client.option.KeyBinding; import net.minecraft.client.util.InputUtil; import net.minecraftforge.api.distmarker.Dist; 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 b24933163..69bc67b24 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/forge/PaladinFurnitureModForge.java @@ -1,14 +1,22 @@ package com.unlikepaladin.pfm.forge; +import com.google.common.base.Suppliers; +import com.mojang.bridge.game.PackType; import com.unlikepaladin.pfm.PaladinFurnitureMod; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.config.PaladinFurnitureModConfig; -import com.unlikepaladin.pfm.data.forge.PFMTagsImpl; import com.unlikepaladin.pfm.registry.dynamic.forge.LateBlockRegistryForge; import com.unlikepaladin.pfm.registry.forge.*; -import net.minecraft.tag.BlockTags; -import net.minecraft.util.Identifier; +import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.SharedConstants; +import net.minecraft.resource.ResourcePackProfile; +import net.minecraft.resource.ResourcePackSource; +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.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLPaths; @@ -41,4 +49,13 @@ public PaladinFurnitureModForge() { LateBlockRegistryForge.addDynamicBlockRegistration(); PaladinFurnitureMod.isClient = FMLEnvironment.dist == Dist.CLIENT; } + + @SubscribeEvent + public static void generateResources(AddPackFindersEvent event) { + PackResourceMetadata packResourceMetadata = new PackResourceMetadata(Text.literal("pfm-runtime-resources"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); + event.addRepositorySource((profileAdder, factory) -> profileAdder.accept(factory.create("pfm-resources", Text.literal("PFM Resources"), true, + () -> new PathPackRPWrapper(Suppliers.memoize(() -> { + PFMRuntimeResources.prepareAndRunResourceGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata) + , packResourceMetadata, ResourcePackProfile.InsertionPosition.BOTTOM, ResourcePackSource.PACK_SOURCE_NONE, true))); + } } diff --git a/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMMinecraftServerMixin.java b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMMinecraftServerMixin.java index 311abf22b..b1d4854d3 100644 --- a/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMMinecraftServerMixin.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMMinecraftServerMixin.java @@ -1,9 +1,15 @@ package com.unlikepaladin.pfm.mixin.forge; +import com.google.common.base.Suppliers; import com.google.common.collect.ImmutableList; +import com.mojang.bridge.game.PackType; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; +import net.minecraft.SharedConstants; import net.minecraft.resource.ResourcePack; +import net.minecraft.resource.metadata.PackResourceMetadata; import net.minecraft.server.MinecraftServer; +import net.minecraft.text.Text; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -15,15 +21,13 @@ @Mixin(MinecraftServer.class) public class PFMMinecraftServerMixin { - @Inject(method = "lambda$reloadResources$15", at = @At(value = "RETURN"), cancellable = true) + @Inject(method = "lambda$reloadResources$15", at = @At(value = "RETURN"), cancellable = true, remap = false) private void createReload(CallbackInfoReturnable> cir) { + PFMRuntimeResources.RESOURCE_PACK_LIST = new ArrayList<>(cir.getReturnValue()); List resourcePacks = new ArrayList<>(cir.getReturnValue()); - if (PFMRuntimeResources.ready) { - PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks; - //PFMRuntimeResources.runAsyncResourceGen(); No async for anyone, too bad forge won't behave - PFMRuntimeResources.prepareAndRunResourceGen(false); - resourcePacks.add(PFMRuntimeResources.ASSETS_PACK); - } + PackResourceMetadata packResourceMetadata = new PackResourceMetadata(Text.literal("pfm-runtime-resources"), SharedConstants.getGameVersion().getPackVersion(PackType.RESOURCE)); + resourcePacks.add(new PathPackRPWrapper(Suppliers.memoize(() -> { + PFMRuntimeResources.prepareAndRunResourceGen(false); return PFMRuntimeResources.ASSETS_PACK;}), packResourceMetadata)); cir.setReturnValue(ImmutableList.copyOf(resourcePacks)); } } diff --git a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMReloadableResourceManagerImplMixin.java similarity index 60% rename from common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java rename to forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMReloadableResourceManagerImplMixin.java index b5244bc95..445201b18 100644 --- a/common/src/main/java/com/unlikepaladin/pfm/mixin/PFMReloadableResourceManagerImplMixin.java +++ b/forge/src/main/java/com/unlikepaladin/pfm/mixin/forge/PFMReloadableResourceManagerImplMixin.java @@ -1,5 +1,6 @@ -package com.unlikepaladin.pfm.mixin; +package com.unlikepaladin.pfm.mixin.forge; +import com.unlikepaladin.pfm.client.PathPackRPWrapper; import com.unlikepaladin.pfm.runtime.PFMRuntimeResources; import net.minecraft.resource.ReloadableResourceManagerImpl; import net.minecraft.resource.ResourcePack; @@ -12,16 +13,12 @@ @Mixin(value = ReloadableResourceManagerImpl.class) public class PFMReloadableResourceManagerImplMixin { - private static int count = 0; + @ModifyVariable(at = @At(value = "HEAD"), method = "reload", argsOnly = true) private List createReload(List packs) { List resourcePacks = new ArrayList<>(packs); - if (PFMRuntimeResources.ready) { - PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks; - //PFMRuntimeResources.runAsyncResourceGen(); No async for anyone, too bad forge won't behave - PFMRuntimeResources.prepareAndRunResourceGen(false); - resourcePacks.add(PFMRuntimeResources.ASSETS_PACK); - } - return resourcePacks; + resourcePacks.removeIf(pack -> pack instanceof PathPackRPWrapper); + PFMRuntimeResources.RESOURCE_PACK_LIST = resourcePacks; + return packs; } } \ No newline at end of file diff --git a/forge/src/main/resources/pfm.mixins.json b/forge/src/main/resources/pfm.mixins.json index 85a6b5b05..ba715cdba 100755 --- a/forge/src/main/resources/pfm.mixins.json +++ b/forge/src/main/resources/pfm.mixins.json @@ -10,6 +10,7 @@ "mixins": [ "PFMAbstractTagProvider$ObjectBuilderMixin", "PFMCookingPotBlockEntityMixin", + "PFMReloadableResourceManagerImplMixin", "PFMMinecraftServerMixin" ], "injectors": { diff --git a/gradle.properties b/gradle.properties index 255e6441a..0300876e9 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.2.0-rc5 +mod_version=1.2.0-rc6 maven_group=com.unlikepaladin architectury_version=5.12.42