#Adding an optional Built-In Resourcepack to a Fabric Mod

9 messages · Page 1 of 1 (latest)

rigid carbon
#

I have packed a data- and resourcepack used for a data driven mod as a fabric mod for easier distribution and install.
The textures of the main>resources>assets folder are included in the "Fabric Mods" Resourcepack as far as I can tell.
Now I wanted to provide players with optional resourcepacks that will overwrite the standard asset folder.
I checked how Continuity did it, by putting a folder in "resources" called "resourcepacks", but this doesnt seem to work in my mod once I built it...
Is there some specific code I need to make before, or am I doing something wrong?

sly charm
#

did you see how continuity registered the packs?

rigid carbon
#

I'm not sure how it works, I thought fabric would recognize the "resourcepacks" folder and add the resourcepack

rigid carbon
fallow token
#

import net.fabricmc.fabric.api.resource.ResourceManagerHelper;

rigid carbon
# fallow token https://github.com/PepperCode1/Continuity/blob/c1c49406ba7104a4117d1a2074afc577d...

Thank you, looks right
However, after I imported the resource manager helper, and registered a built in resource pack, FabricLoader cannot be resolved
Did I miss importing something?

package com.chromexunderscore.originstweaks;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main implements ModInitializer {
    public static final String ID = "originstweaks";
    public static final String NAME = "OriginsTweaks";
    public static final Logger LOGGER = LoggerFactory.getLogger(NAME);
    @Override
    public void onInitialize() {
        LOGGER.info("[OriginsTweaks] Remember to enable flying in the server.properties for some movement abilites!");
    };
    public void onInitializeClient() {
                //this v
        FabricLoader.getInstance().getModContainer(ID).ifPresent(container -> {
            ResourceManagerHelper.registerBuiltinResourcePack(asId("elytra_wings"), container, ResourcePackActivationType.NORMAL);
        });
    }
}
sly charm
#

yeah you need to import the classes from fabric loader

#

import net.fabricmc.loader.api.FabricLoader;