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'm trying to render an icon for a custom potion effect. below  is the code i have:

import shadow.fusion.misc.Reference;

public class SunBlock extends Potion {
	
	public static final ResourceLocation RESOURCE_ICON = new ResourceLocation("fusiontweaks:inventory.png");
	
	public SunBlock(int id, boolean bad, int amp) {
		super(id, bad, amp);
		this.setPotionName("Sun Block");
		// TODO Auto-generated constructor stub
		//this.setPotionName("sun_block");
	}
  
	@Override
	public boolean hasStatusIcon() {
		return false;
	}
	
	
	public void renderInventoryEffect(int x, int y, PotionEffect effect, net.minecraft.client.Minecraft mc) { 
		if (effect.getPotionID() == ConfigHandler.potID) {
			//int l = 0;
			System.out.println(RESOURCE_ICON.toString());
			mc.getTextureManager().bindTexture(RESOURCE_ICON);
			//Minecraft.getMinecraft().renderEngine.bindTexture(RESOURCE_ICON);
			mc.ingameGUI.drawTexturedModalRect(x+6, y+7, 0, 198, 18, 18);
			//mc.renderEngine.deleteTexture(RESOURCE_ICON);
			//mc.renderEngine.bindTexture(new ResourceLocation("textures/gui/container/inventory.png"));
			
			
		}
	}
		
}

the file is in main/assets/fusiontweaks/inventory.png

i have also tried to load the resource with the two argument constructor.

the hook to the rendering moment works correctly, i have successfully drawn a coloured square in the correct position with  mc.ingameGUI.drawRect(x+6, y+7, x+24, y+25, -100023234);

 

when i try to use the above code to draw an icon from my assets however, nothing gets drawn.

 

any help with the problem would be appreciated.

S-

 

 

 

 

 

 

  • Guest locked this topic
Guest
This topic is now closed to further replies.

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.