PaperMC / PaperMC/Paper

Cant cancel properly ender dragon spawn with CreatureSpawnEvent

Open
#5,763 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted type: bug version: 1.16
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Expected behavior

After canceling the spawn of a dragon from CreatureSpawnEvent, a bossbar should not appear since the dragon's spawn is canceled
Note: Nether portal is cancelled, only the end portal is not.

Observed/Actual behavior

After canceling the spawn of the CreatureSpawnEvent dragon, a boss bar appears, and the event is canceled (the dragon is not spawn but regardless a boss bar appears)

http://prntscr.com/121u9mc

Steps/models to reproduce
@EventHandler

protected void onDragonSpawn(CreatureSpawnEvent event) {
if (event.getEntityType() == EntityType.ENDER_DRAGON &&
event.getLocation().getWorld().getEnvironment() == Environment.THE_END) {
EnderDragon dragon = ((EnderDragon) event.getEntity());

	dragon.getBossBar().removeAll();
	dragon.getDragonBattle().generateEndPortal(false);

	event.setCancelled(true);
}

}

Plugin list

FastAsyncWorldEdit-Bukkit-1.16-655
HolographicDisplays
Multiverse-Core-4.2.2
ProtocolLib

Paper version

This server is running Paper version git-Paper-756 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
You are running the latest version
Previous version: git-Paper-a98d389d1 (MC: 1.16.5)

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

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the CreatureSpawnEvent handling for EnderDragon entities and the related Ender Dragon boss bar and DragonBattle end-portal logic. Reproduce the provided handler on Paper 1.16.5, then verify that canceling the end-portal dragon spawn prevents the boss bar while preserving the stated Nether-portal behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.