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

I currently testing textures so am placing them right in the c drive but when I said the texture was at c:\\texture.png I end up with the pink and black texture, in the end i will want to get the picture from the minecraft folder\subfolder\subfolder so the principle should be the same, but i do not know how to get minecraft to look side of my mod for the texture.

 

One other this must work with ResourceLocation.

place ur textures under src/main/resources/assets/MOID/epicsubfolder

and access them via new ResourceLocation("MODID:epicsubfolder/texure.png");

(if u want to access them for gui rendering to bind it via bindTexture)

  • Author

The mod needs to able load from outside texture pack as my mod need build image first from two images given by images give by the user

Oh god no, please don't use slick.

You want to bring external resources into Minecraft's resource system? Implement IResourcePack however you wish and put it in Minecraft#defaultResourcePacks.

Then you can use normal ResourceLocations as if the external resources were in your mod.

 

But sometimes it is required to bind textures that are loaded from a BufferedImage and this is possible with slick.

  • Author

Oh god no, please don't use slick.

You want to bring external resources into Minecraft's resource system? Implement IResourcePack however you wish and put it in Minecraft#defaultResourcePacks.

Then you can use normal ResourceLocations as if the external resources were in your mod.

 

So I have Implemented IResourcePack however my textures still will not load I believe it have to do something with the methods it added but i have no idea where to start.

  • Author

Here is my code from the class in question

 

package dijkstra.wardrobe.main;

 

import java.awt.image.BufferedImage;

import java.io.IOException;

import java.io.InputStream;

import java.lang.reflect.Field;

import java.util.Set;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.entity.AbstractClientPlayer;

import net.minecraft.client.resources.IResourcePack;

import net.minecraft.client.resources.data.IMetadataSection;

import net.minecraft.client.resources.data.IMetadataSerializer;

import net.minecraft.util.ChunkCoordinates;

import net.minecraft.util.IChatComponent;

import net.minecraft.util.ResourceLocation;

import net.minecraft.world.World;

 

import com.mojang.authlib.GameProfile;

 

public class testReflections implements IResourcePack{

public static ResourceLocation oldSkin;

public static AbstractClientPlayer player = Minecraft.getMinecraft().thePlayer;

public static void load(){

Class Skin = AbstractClientPlayer.class;

try {

 

Field locationSkin = AbstractClientPlayer.class.getDeclaredField("locationSkin");

locationSkin.setAccessible(true);

oldSkin = (ResourceLocation) locationSkin.get(player);

 

locationSkin.set(Minecraft.getMinecraft().thePlayer, setSkin(skin.Custom));

}

catch (Exception e){

e.printStackTrace();

}

 

 

}

private static ResourceLocation setSkin(skin skin){

switch(skin){

case Custom:

return new ResourceLocation("c:\\playerModel.png");

case Default:

return oldSkin;

case Steve:

return null;

default:

return null;

}

 

}

private enum skin{

Default,

Steve,

Custom

}

@Override

public InputStream getInputStream(ResourceLocation p_110590_1_)

throws IOException {

// TODO Auto-generated method stub

return null;

}

@Override

public boolean resourceExists(ResourceLocation p_110589_1_) {

// TODO Auto-generated method stub

return false;

}

@Override

public Set getResourceDomains() {

// TODO Auto-generated method stub

return null;

}

@Override

public IMetadataSection getPackMetadata(IMetadataSerializer p_135058_1_,

String p_135058_2_) throws IOException {

// TODO Auto-generated method stub

return null;

}

@Override

public BufferedImage getPackImage() throws IOException {

// TODO Auto-generated method stub

return null;

}

@Override

public String getPackName() {

// TODO Auto-generated method stub

return null;

}

}

 

 

It mainly for test as the moment until I can get it working right

 

Edit:

at moment is trigger ever render tick using event handlers.

But sometimes it is required to bind textures that are loaded from a BufferedImage and this is possible with slick.

You do not need slick to do that. Minecraft does it already with e.g. maps.

 

Ah - okay :D Never had a look at that.

  • Author

At the moment I am just testing thing things are not tidy yet, and I at the time I did not really IResourcePack was i though that if that if class implemented it would let me use resources outside of the mod jar.

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.