Jump to content

Recommended Posts

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.

Posted

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)

Posted

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.

Posted

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.

Posted

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.

Posted

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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