Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

My IResourcePack ask for mcmeta files, instead of images, have done something wrong it is definitely requesting files from my IResourcePack so it wired up right.

 

IResourcePack Class:

 

package dijkstra.wardrobe.client;

import com.google.common.collect.ImmutableSet;
import dijkstra.wardrobe.Logging;
import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.data.IMetadataSection;
import net.minecraft.client.resources.data.MetadataSerializer;
import net.minecraft.util.ResourceLocation;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Set;

public class ResourceLoader implements IResourcePack {

    public static final Set<String> RESOURCE_DOMAINS = ImmutableSet.<String>of("wardrobe");

    @Override
    public InputStream getInputStream(ResourceLocation location) throws IOException {
        File path = new File("resources/wardrobe/textuers/");
        if(!path.exists()){
            path.mkdirs();
        }
        if(resourceExists(location)){
            String name = location.getResourcePath();
            if(name.contains(".mc"))
                name = name.substring(0, name.indexOf('.'));
            Logging.info(name);
            File file  = new File(String.format("resources/wardrobe/textuers/%s.png", name));
            Logging.info(file.toString());
            return new FileInputStream(file);
        }
        return null;
    }

    @Override
    public boolean resourceExists(ResourceLocation location) {
        return true;
        //return new File(String.format("/resources/wardrobe/textuers/%s.png", location.getResourcePath())).exists();
    }

    @Override
    public Set<String> getResourceDomains() {
        return RESOURCE_DOMAINS;
    }

    @Override
    public <T extends IMetadataSection> T getPackMetadata(MetadataSerializer metadataSerializer, String metadataSectionName) throws IOException {
        return null;
    }

    @Override
    public BufferedImage getPackImage() throws IOException {
        return null;
    }

    @Override
    public String getPackName() {
        return "Wardrobe";
    }
}

 

  • Author

Return true is just for testing so i can print the files it is asking for to the log.

So do  i need to make an empty mcmate file for each image I want to load this as it asks for mcmeta files instead of files

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.