Posted September 11, 201510 yr 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.
September 11, 201510 yr 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)
September 11, 201510 yr 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
September 11, 201510 yr You can use SlickUtil to load images from the system and also to bind it to a glContext. Download it here: http://slick.ninjacave.com/slick-util.zip
September 11, 201510 yr 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.
September 11, 201510 yr 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.
September 11, 201510 yr 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.
September 11, 201510 yr 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 Never had a look at that.
September 11, 201510 yr 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.