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 do a set of armor that when the player is full equipped he will be fireproof (no damage when in lava or in touch with fire). For now it work well when I'm in lava but when I jump out I still burning and start to lose hp.

 

Any help? I tried this way and the commented way:

 

public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {

	EntityPlayer player = (EntityPlayer) par3Entity;

	if (	player.inventory.armorItemInSlot(0) != null && 
			player.inventory.armorItemInSlot(1) != null &&
			player.inventory.armorItemInSlot(2) != null &&
			player.inventory.armorItemInSlot(3) != null
			)
	{
	     ItemStack itemstack0 = player.inventory.armorItemInSlot(0);
	     ItemStack itemstack1 = player.inventory.armorItemInSlot(1);
	     ItemStack itemstack2 = player.inventory.armorItemInSlot(2);
	     ItemStack itemstack3 = player.inventory.armorItemInSlot(3);
	     
	        if (	itemstack0.itemID == SunSonMod.fireProtectedHelmet.itemID &&
	        		itemstack1.itemID == SunSonMod.fireProtectedPlate.itemID &&
	        		itemstack2.itemID == SunSonMod.fireProtectedLegs.itemID &&
	        		itemstack3.itemID == SunSonMod.fireProtectedBoots.itemID		        		
	        		)
	        {
	        	/*if(player.isBurning()){
	        		player.extinguish();
	        	}*/
	        	
	        	if(!itemstack0.isItemEnchanted() && !itemstack1.isItemEnchanted() && !itemstack2.isItemEnchanted() && !itemstack3.isItemEnchanted()){
	        		itemstack0.addEnchantment(Enchantment.fireProtection, 1000);
	        		itemstack1.addEnchantment(Enchantment.fireProtection, 1000);
	        		itemstack2.addEnchantment(Enchantment.fireProtection, 1000);
	        		itemstack3.addEnchantment(Enchantment.fireProtection, 1000);
	        		
	        	}
	        }
	}    

}

 

 

  • Author

There is a method onArmorTickUpdate in the Item class. That's what you need.

 

I tried and still the same. When I'm in lava I don't lose hp but when I jump out I start taking damage

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.