Jump to content

Recommended Posts

Posted (edited)

I wrote a coremod to piss Lex off.

 

The coremod is pretty simple, less than 100 lines:

 

[code to insert call to a @Cancelable Event into PotionEffect.performEffect]

 

All it does is patch PotionEffect.performEffect such that it calls my code, and then my code decides whether to run normal routines or exit (basically a cancellable event).

 

The handler code just grabs the effective ItemStack and calls this method on it:

 

        public boolean checkPotion(PotionEffect potion, EntityLivingBase entity, ItemStack is) {
                NBTTagCompound tag = is.getOrCreateSubCompound("chew");
                NBTTagCompound subtag = tag.getCompoundTag("potion");
                String key = Potion.REGISTRY.getNameForObject(potion.getPotion()).toString().intern();
                boolean b = subtag.getBoolean(key);
                subtag.setBoolean(key, !b);
                tag.setTag("potion", subtag);
                return b;
        }

 

Which simply makes the potion tick only half the time.

 

Would it be possible to have this event in Forge?

Edited by SoniEx2

No, you do NOT need jar modding!

Posted

"I wrote a coremod you must add my coremod!" 

We do not accept 'suggestions' like this. Please file a suggestion correctly explaining what you want and what you are trying to achieve it for.

I've removed your coremod code and your advertisement for your coremod.

Don't do that.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Posted (edited)

I wrote a coremod because the hook I needed doesn't exist. I explained how the hook works. now you come and tell me I didn't?

 

I also had linked an example mod that would use the hook.

Edited by SoniEx2

No, you do NOT need jar modding!

  • mezz locked this topic
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.