Paper icon indicating copy to clipboard operation
Paper copied to clipboard

EntityBreeding Stuck in a Loop When Event is Cancelled

Open WOLFI3654 opened this issue 4 years ago • 7 comments

Expected behavior

When the EntityBreedEvent is cancelled, their loveTicks should be reset.

Observed/Actual behavior

When cancelling the EntityBreedEvent the two animals will try again every few seconds to produce a baby as long as they are still willing. This results in subsequent calls the EntityBreedEvent. If you cancel this event, your intention is generally to disallow breeding for the two animals, and not to postpone it.

Steps/models to reproduce

A very simple plugin is sufficient to experience this behavior:


  @Override
  public void onEnable() {
    Bukkit.getPluginManager().registerEvents(this,this);
  }
  
  @EventHandler
  public void onBreed(EntityBreedEvent e){
    e.setCancelled(true);
    Bukkit.broadcastMessage("Breed");
  }

Plugin list

Empty; Except plugin to test the EntityBreedEvent cancel behavior.

Paper version

[17:16:49 INFO]: This server is running Paper version git-Paper-575 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT) You are running the latest version Previous version: git-Paper-457 (MC: 1.16.5)

Agreements

  • [X] I am running the latest version of Paper available from https://papermc.io/downloads.
  • [X] I have searched for and ensured there isn't already an open issue regarding this.
  • [X] My version of Minecraft is supported by Paper.

Its certainly not a behavior that should be expected when cancelling the event. Tho this can be circumvented by resetting the loveModeTicks manually, just doing it by default when the event is cancelled would be a neat improvement to the api. Its really easy to miss that especially if you are new to plugin development and depending on your use case could result in quite unexpected and unnoticed performance issues.

WOLFI3654 avatar Apr 01 '21 15:04 WOLFI3654

This must be submitted upstream as to not break API.

Proximyst avatar Apr 01 '21 15:04 Proximyst

Thank you, how exactly do I file an issue on the bukkit/spigot upstream?

WOLFI3654 avatar Apr 05 '21 13:04 WOLFI3654

@WOLFI3654 you need to go to https://hub.spigotmc.org/jira/projects/SPIGOT/issues/ and create new issue there. For the future, this can be found by googling spigotmc jira

Prof-Bloodstone avatar Apr 05 '21 13:04 Prof-Bloodstone

Thanks, I already tried that at some point in time but I had a few issues. I'll see what I can do

WOLFI3654 avatar Apr 05 '21 13:04 WOLFI3654

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 04 '21 13:06 stale[bot]

Thank you very much!

WOLFI3654 avatar Jun 06 '21 16:06 WOLFI3654