Jump to content

Enchanted armor


ColdFox

Recommended Posts

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);
	        		
	        	}
	        }
	}    

}

 

 

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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