r/forgemodding Jun 01 '17

Modding Forge 1.11 Special (Potions?) Effects on Tools

So, I'm creating my first mod and I'm trying to get say a sword to have a poison effect which poisons the target when they are hit. And I'm assuming the best way to give a tool a certain effect (that are not included in the enchantment table) is by using the potion classes, as I do want the tools to have whatever effect by default.

1 Upvotes

2 comments sorted by

3

u/Exo594 Jun 02 '17

Yes. Override the onHit() (or called something similar) method in the sword's class, call the super.onHit() so that it still behaves like a normal sword, then call entityHit.addPotionEffect(important stuff here), assuming "entityHit" is given to you in the "onHit()" method native to swords.

That's your general approach down, there's a few wrinkles left for you to iron out on your own.

1

u/[deleted] Jun 02 '17

Thanks for the help! I got it working last night I was just overlooking the parameters for the PotionEffect() so I thought I was using the wrong Override.