PaperMC / PaperMC/Paper

I can't cancel the creation of the end portal

Open
#5,547 14 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

When canceling the PortalCreateEvent or EntityPortalCreateEvent he should block the portal from being created
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

When canceling PortalCreateEvent or EntityPortalCreateEvent he is allowing the creation of portals but I believe the problem here is that the event is not being called so it is not canceled ...
After canceling the spawn of the CreatureSpawnEvent dragon, a boss bar appears, and the event is canceled (the dragon is not born but regardless a boss bar appears)

http://prntscr.com/121u9mc
http://prntscr.com/121uaap

Steps/models to reproduce
@EventHandler // Not running
protected void onEntityCreatePortal(PortalCreateEvent event) {
	if (event.getWorld().getEnvironment() == Environment.THE_END)
		event.setCancelled(true);
}

@EventHandler // Not running
protected void onDragonEggSpawn(DragonEggFormEvent event) {
	event.setCancelled(true);
}

    @EventHandler // Running but with bugs
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-629 (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.

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 PortalCreateEvent, EntityPortalCreateEvent, DragonEggFormEvent, and CreatureSpawnEvent handling for End portal and Ender Dragon creation. Reproduce the report on the stated Paper 1.16.5 version, then verify that canceling portal or dragon creation prevents the corresponding portal and boss bar from appearing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
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.