Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

1.12.2 Adding Mechanics to an Existing Enchantment


Recommended Posts

I was wondering how I would go about adding mechanics to a currently existing enchantment. I am trying to add functionality to the curse of binding in this case, so I figure I would have to make a class that extends from this enchantment right?

Link to post
Share on other sites

That's not how extending a class works.

Depending on what, exactly, you want to do, there are a number of ways to achieve it. You just have to tell us what you want to do.

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.

Link to post
Share on other sites
27 minutes ago, Nasch said:

Thanks for the response. The idea was to make it so an armor piece with the curse of binding enchantment would automatically equip to the player if it is in your inventory.

If you want it to be forced to stay equipped you would have to use the PlayerTickEvent and iterate through there inventory and upon finding one move it to the armor slot, but only if there already isn't one. And watch out for concurrent modification exceptions. 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to post
Share on other sites
7 minutes ago, Animefan8888 said:

If you want it to be forced to stay equipped you would have to use the PlayerTickEvent and iterate through there inventory and upon finding one move it to the armor slot, but only if there already isn't one. And watch out for concurrent modification exceptions. 

Greatly appreciated. Just wondering how I would establish the connection between the existing enchantment and the mechanics I want to add though. 

Link to post
Share on other sites
28 minutes ago, Nasch said:

Greatly appreciated. Just wondering how I would establish the connection between the existing enchantment and the mechanics I want to add though. 

Check if any of the Items in the players inventory as you iterate to see if they have the enchantment on them.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to post
Share on other sites
5 minutes ago, Animefan8888 said:

Check if any of the Items in the players inventory as you iterate to see if they have the enchantment on them.

Oh, I got ya. I guess I was just overthinking how to do things. Thanks.

 

So, in general, I just need to make a new class that holds the functionality I want for the enchantment and register the event?

Edited by Nasch
Link to post
Share on other sites
24 minutes ago, Nasch said:

So, in general, I just need to make a new class that holds the functionality I want for the enchantment and register the event?

Yes. That should be it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to post
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.

Guest
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 Privacy Policy.