Boss Fight
Script Description
When an Ender Dragon is killed in the end, a wither is spawned. Players cannot go back to the overworld without killing the wither as well.
Part 1: Creating The Event
First, we're going to create a new event which is called when an Ender Dragon is killed in the event. We'll be using the Entity Death Event for this.
Part 2: Spawning The Wither
We're going to check if the killed dragon was in the end dimension, if it was, then we're going to set a global variable (witherspawned for the sake of this tutorial) to true. Now we're going to add an elseif statement
to our previous if statement
where we confirmed that the killed entity was a dragon. This time, in the else if statement, we're going to confirm that the killed entity is a wither. Next, let's check if the variable we created earlier (witherspawned) is true, and if it is, then delete it. And that's it for this part.
Part 3: Disabling Portal Teleportation
Now finally, we're going to add a new event which is called when a player enters the end dimension. We're going to do this with the Player Portal Event. Now, we're going to add an if statement
to confirm that the player was previously in the end world, to do this we're going add an if statement
to confirm that event-world
is world_the_end
. Finally, if our variable (witherspawned) is true, then cancel the event.
Last updated