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

Hello, i am currently developing mod, which bring clans into the game and i need  pass the clan's icon from server to client. This icon have a light weight (it's 16x16) and i think it will be good to keep them all in ./icons folder of the Minecraft directory. But i don't know to convert File to ResourceLocation to render it in the game. Can somebody help me with this?

1. Pack all .png to 256x256 sheet.

2. Put that sheet somewhere in server files.

3. Create SpecialResourcePack extends AbstractResourcePack (or FileResourcePack).

4. Use packets (send .png as stream): either SimpleNetworkWrapper or setup your own sending (open new thread)

5. On receiver (client) side you will now have some .png - use SpecialResourcePack to load image as resource (inputStream).

6. Use:

mc.getTextureManager().bindTexture(textureSheet);
this.drawTexturedModalRect(x, y, u, v, 16, 16);

To draw image.

 

Note: Instead of writing whole new implementation of ResourcePack you can use FileResourcePack.

1. After finishing downloading .png, place it into .zip or .jar (on client side).

2. Load .jar/.zip as FileResourcePack.

3. That way you will also inherit file structure (e.g: assets/something/lol/textureSheet.png) of that .jar.

 

Example of loading FileResourcePack:

List<IResourcePack> defaultResourcePacks = ObfuscationReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "defaultResourcePacks", "field_110449_ao");

defaultResourcePacks.add(new MyFileResourcePack(new File("C:/Users/Me/Something/.minecraft/theJar.jar")));
Minecraft.getMinecraft().refreshResources();

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

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.