Jump to content

Recommended Posts

Posted

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?

Posted

check if the player is wearing all the armor. and if they are, set the player invincible.

How do i set the player to invincible and check if their wearing the armor or at least what class would i look in?

 

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

Posted

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?

Posted

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

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.