Jump to content

Recommended Posts

Posted

Hello Guys :)

 

I have a Question for you. How can i create a Set Armor like in a RPG which gives u when wearing 2 Items an Enchantment like DigSpeed, when u wear 3 Items it gives u Movement Speed and on 4 Items it adds Absorbtion.

 

I've tried this but it didn't worked...

The Armor Class:

 

  Reveal hidden contents

 

 

armorEnch Class:

 

  Reveal hidden contents

 

 

The armorEnch Class is used for the setEnch in the Armor Class...

 

I've tried it this way but it did not work...

 

I seek for help :/

Guest Abrynos
Posted

You have to create a armor tick handler and cover every possibility with if statements

Posted
  On 7/31/2014 at 9:07 PM, xXxKanemanxXx said:

So the OnArmorTick in the Armor Class is not necessary or what ?

 

That is exactly what Abyrnos is saying. The function "onArmorTick" in the custom Armor class is where you would have the series of conditional statements to achieve your goal. It might be a lengthy process and I'd highly recommend writing out all possible combinations.

Posted

I have it already done like that, not all combinations but a few

 

my Crashlog when i'm using it like i've posted it in the first post:

 

  Reveal hidden contents

 

 

My Armor Class:

 

  Reveal hidden contents

 

Posted

My first question is why are you calling for "getCurrentArmor" in your if statements when you've already created ItemStacks for those slots just lines above?

 

But realistically, I think that the problem you are having is that you are adding enchantments to armor, EVERY TICK. The code you have there doesn't just add ONE enchantment and stop, it adds "Unbreaking I" to your armor for EVERY tick that condition is true. This eventually leads to a NullPointException (I'm not sure the crash occurs because of how many enchantments you have on the piece or because you take the armor off).

 

The way you made it seem in the first post was that you were going to be modifying the player's dig speed, movement speed, and other things that can be controlled either by potion effects or through EntityPlayer. If you are going to be adding an enchantment to a set of armor while you are wearing it, then this method is not for you.

Posted

Looking at it a bit more, you could probably check to see if the item is enchanted before adding the enchantment to it. Keep in mind though, you can't easily remove the enchantment from the item. So if someone were to take off the armor, the armor would still be enchanted.

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.