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

Hi, it's possible to transform a url (wich locate an image png) to a resource location?

i know how to download the image but i can't transform it to a resource location

Hi, it's possible to transform a url (wich locate an image png) to a resource location?

i know how to download the image but i can't transform it to a resource location

Nope it is not... And what you're doing is (can be better) done in completely other way...

elix, what? You are wrong (about 1st thing) :D

 

It is possible. I am assuming you are asking about loading .png file from anywhere. In that case you can implement IResourcePack that allows you to generate virtual resources with getInputStream. Once you generate resources you can put them into Minecraft#defaultResourcePacks using reflection (ReflectionObfuscationHelper).

 

Note: getInputStream allows any input, you can probably use direct stream from Http, just make sure to use multi-threading when you are downloading files.

1.7.10 is no longer supported by forge, you are on your own.

elix, what? You are wrong (about 1st thing) :D

 

It is possible. I am assuming you are asking about loading .png file from anywhere. In that case you can implement IResourcePack that allows you to generate virtual resources with getInputStream. Once you generate resources you can put them into Minecraft#defaultResourcePacks using reflection (ReflectionObfuscationHelper).

 

Note: getInputStream allows any input, you can probably use direct stream from Http, just make sure to use multi-threading when you are downloading files.

He wanted to transform Image to ResourceLocation, which is not possible. ResourceLocation is just reference, "path", to resource with modid and internal path. What he needed to use, you said above...

elix, what? You are wrong (about 1st thing) :D

 

It is possible. I am assuming you are asking about loading .png file from anywhere. In that case you can implement IResourcePack that allows you to generate virtual resources with getInputStream. Once you generate resources you can put them into Minecraft#defaultResourcePacks using reflection (ReflectionObfuscationHelper).

 

Note: getInputStream allows any input, you can probably use direct stream from Http, just make sure to use multi-threading when you are downloading files.

He wanted to transform Image to ResourceLocation, which is not possible. ResourceLocation is just reference, "path", to resource with modid and internal path. What he needed to use, you said above...

No. It is actually possible. Think about skin, it is also from URL!

So, Look into the class 'DynamicTexture'. It will give you a hint.

+ This thread will also help you: http://www.minecraftforge.net/forum/index.php/topic,25161.msg127886.html#msg127886

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

elix, what? You are wrong (about 1st thing) :D

 

It is possible. I am assuming you are asking about loading .png file from anywhere. In that case you can implement IResourcePack that allows you to generate virtual resources with getInputStream. Once you generate resources you can put them into Minecraft#defaultResourcePacks using reflection (ReflectionObfuscationHelper).

 

Note: getInputStream allows any input, you can probably use direct stream from Http, just make sure to use multi-threading when you are downloading files.

He wanted to transform Image to ResourceLocation, which is not possible. ResourceLocation is just reference, "path", to resource with modid and internal path. What he needed to use, you said above...

No. It is actually possible. Think about skin, it is also from URL!

So, Look into the class 'DynamicTexture'. It will give you a hint.

+ This thread will also help you: http://www.minecraftforge.net/forum/index.php/topic,25161.msg127886.html#msg127886

ResourceLocation and Dynamic texture or New resource pack are different things. Resource location is just 2 strings showing mc resource path... But in order to display that texture, you need or DynaimcTexture or dynamic resource pack... Again, ResourceLocation is just a location, path and not texture it self...

ResourceLocation and Dynamic texture or New resource pack are different things. Resource location is just 2 strings showing mc resource path... But in order to display that texture, you need or DynaimcTexture or dynamic resource pack... Again, ResourceLocation is just a location, path and not texture it self...

Yes, you're right. I might see illusion or something... (I saw something setting ResourceLocation in DynamicTexture code)

Anyway, Dynamic Texture will be needed to do what OP wanted to do.

 

EDIT: I'd upse my previous admission, see TextureManager#getDynamicTextureLocation code.

It registers the DynamicTexture with key 'ResourceLocation'.

So in this case ResourceLocation is actually an abstract expression of resource location, as key for the resource

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.