Jump to content

Invincible Armor


kenoba10

Recommended Posts

Hi. In my mod I have an armor set that i want to be invincible so the player takes no damage. Here's my code:

public static EnumArmorMaterial armorInvincible = EnumHelper.addArmorMaterial("Invincible", 0, new int[] {0, 0, 0, 0}, 30);

How do I do this?

Link to comment
Share on other sites

if (player.getCurrentItemOrArmor(4) != null && player.getCurrentItemOrArmor(3) != null
    				&& player.getCurrentItemOrArmor(2) != null && player.getCurrentItemOrArmor(1) != null)
    		{
        		if(this.armorType == 0)
        		{
        			ItemStack helmet = player.getCurrentItemOrArmor(4);
        			ItemStack chest = player.getCurrentItemOrArmor(3);
        			ItemStack legs = player.getCurrentItemOrArmor(2);
        			ItemStack boots = player.getCurrentItemOrArmor(1);
        			
        			if (helmet.getItem() == HELMET && chest.getItem() == CHESTPLATE
        					&& legs.getItem() == LEGS && boots.getItem() == BOOTS)
        			{
        				player.capabilities.disableDamage = true;
                                }
                         }
                }
else if ((player.getCurrentItemOrArmor(4) == null || player.getCurrentItemOrArmor(3) == null
    				|| player.getCurrentItemOrArmor(2) == null || player.getCurrentItemOrArmor(1) == null)
    				&& !player.capabilities.isCreativeMode)
		{
        		         player.capabilities.disableDamage = false;
                        }

Link to comment
Share on other sites

if (player.getCurrentItemOrArmor(4) != null && player.getCurrentItemOrArmor(3) != null
    				&& player.getCurrentItemOrArmor(2) != null && player.getCurrentItemOrArmor(1) != null)
    		{
        		if(this.armorType == 0)
        		{
        			ItemStack helmet = player.getCurrentItemOrArmor(4);
        			ItemStack chest = player.getCurrentItemOrArmor(3);
        			ItemStack legs = player.getCurrentItemOrArmor(2);
        			ItemStack boots = player.getCurrentItemOrArmor(1);
        			
        			if (helmet.getItem() == HELMET && chest.getItem() == CHESTPLATE
        					&& legs.getItem() == LEGS && boots.getItem() == BOOTS)
        			{
        				player.capabilities.disableDamage = true;
                                }
                         }
                }
else if ((player.getCurrentItemOrArmor(4) == null || player.getCurrentItemOrArmor(3) == null
    				|| player.getCurrentItemOrArmor(2) == null || player.getCurrentItemOrArmor(1) == null)
    				&& !player.capabilities.isCreativeMode)
		{
        		         player.capabilities.disableDamage = false;
                        }

do i put this in my main class or in my armor class?

Link to comment
Share on other sites

you do know you can use one class for an entire set of armor. right? in fact, in my mod, I use one armor class for 5 sets of armor.

i found that out recently but I dont know how to i guess i will look it up and try that thanks for the code though i hope it works if it does i will add you to my mod credits

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.

×
×
  • Create New...

Important Information

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