Jump to content

Recommended Posts

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • You can check mod compatibility remove new mods and test them one by one.
    • @Tsuk1 Also, new note, you can use blockbench to make the custom item model for when it is not on the head.   EDIT: Funny story, I am making a mod similar to yours! Mine is called NorseMC.
    • @Nood_dev Could you send a screenshot of your weapon code? Here is the one I made (for a dagger): The specific UUID does not matter, just that it is the same every time, which is why UUID#randomUUID does not work public class DaggerItem extends TieredItem implements Vanishable { protected static final double REACH_MODIFIER = -1.5D; protected final Multimap<Attribute, AttributeModifier> defaultModifiers; protected final UUID BASE_ATTACK_REACH_UUID = UUID.fromString("6fe75b5c-9d1b-4e83-9eea-a1d5a94e8dd5") public DaggerItem(Tier pTier, int pAttackDamageModifier, float pAttackSpeedModifier, Properties pProperties) { super(pTier, pAttackDamageModifier, pAttackSpeedModifier, pProperties); this.attackDamage = (float) pAttackDamageModifier + pTier.getAttackDamageBonus(); ImmutableMultimap.Builder<Attribute, AttributeModifier> builder = ImmutableMultimap.builder(); builder.put(Attributes.ATTACK_DAMAGE, new AttributeModifier(BASE_ATTACK_DAMAGE_UUID, "Weapon modifier", this.attackDamage, AttributeModifier.Operation.ADDITION)); builder.put(Attributes.ATTACK_SPEED, new AttributeModifier(BASE_ATTACK_SPEED_UUID, "Weapon modifier", pAttackSpeedModifier, AttributeModifier.Operation.ADDITION)); // THE ONE YOU WANT: builder.put(ForgeMod.ENTITY_REACH.get(), new AttributeModifier(BASE_ATTACK_REACH_UUID, "Weapon modifier", REACH_MODIFIER, AttributeModifier.Operation.ADDITION)); this.defaultModifiers = builder.build(); } @Override public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot pEquipmentSlot) { return pEquipmentSlot == EquipmentSlot.MAINHAND ? this.defaultModifiers : super.getDefaultAttributeModifiers(pEquipmentSlot); } }
    • https://images.app.goo.gl/1PxFKdxByTgkxvSu6
    • That's what we'll try out. I could never figure out how to recreate the crash, so I'll just have to wait and see.
  • Topics

×
×
  • Create New...

Important Information

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