Jump to content

Recommended Posts

Posted (edited)

For the mod I recently started building I'd like to make heavy use of (potion) effects. If all effects could easily be cancelled through the use of a milk bucket, that would be pretty broken. Is there a way to change the behaviour of existing items (in general), or (specifically) make the milk bucket less powerful in any other way?

 

EDIT: I'm currently coding for MC 1.15

Edited by Kombat Kitten
Posted

I have been able to completely prevent the player from drinking milk. This might not be the perfect solution, so please suggest it if you know something better.

 

The code that prevents the player from drinking milk:


@Mod.EventBusSubscriber
public class EventListening {
    @SubscribeEvent
    public static void useItemStart(LivingEntityUseItemEvent.Start e) {
        SpellCrafters.LOGGER.log(Level.DEBUG, "start using item");

        if(e.getItem().getItem() == Items.MILK_BUCKET) {
            SpellCrafters.LOGGER.log(Level.DEBUG, "drinking milk");
            e.setCanceled(true);
        }
    }
}

 

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.