Jump to content

[1.6.4][SOLVED]Armor not giving player wearing it potion effects


Recommended Posts

Posted

When I equip the armor, it doesn't apply potion effects. I know it is probably being caused by something simple, but I can't figure out what. Here's my code:

Armor File:

 

  Reveal hidden contents

 

Base File:

 

  Reveal hidden contents

 

Let me know if I left anything out of the post, and I will edit it in.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

UPDATE:

I have narrowed it down to the following section of code:

 

  Reveal hidden contents

 

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Posted

And this is where we do things like

 

System.out.println(helmet.getItem() == FireArmorBaseFile.FireHelmet)

 

And see what its doing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Ok, but that doesn't tell us what's failing.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Hi

 

if (helmet.getItem() == FireArmorBaseFile.FireHelmet) {
  player.addPotionEffect((new PotionEffect(Potion.nightVision.getId(), 400, 0)));
}

 

So you say that this line is being executed

if (helmet.getItem() == FireArmorBaseFile.FireHelmet

but it is never true, even when you think the helmet is being worn

 

Depending on how you've coded FireHelmet, this might work instead

if (helmet.getItem().itemID == FireArmorBaseFile.FireHelmet.itemID)

 

BTW that should probably be FireArmorBaseFile.fireHelmet ?

 

If that doesn't work, show us your FireArmorBaseFile.java?

 

-TGG

 

 

Posted

So just to clarify, what do the if statements return that are checking whether or not the player is wearing the armor? We really don't know what the exact problem is...

If you really want help, give that modder a thank you.

 

Modders LOVE thank yous.

Posted

I'm pretty sure you've got the armor slots backwards; the vanilla java docs on this are very confusing, but this is what I've come up with after testing quite a bit:

 

// this is what the java docs will tell you, but it's for rendering position only:

Armor types as used in armor class: 0 helm, 1 chest, 2 legs, 3 boots

 

// this is what is actually used for storing the positions in the player inventory:

Armor types as used on player: 0 boots, 1 legs, 2 chest, 3 helm

 

Use the second set of values with getCurrentArmor or add one for getCurrentItemOrArmor

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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