aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0587-add-DragonEggFormEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0587-add-DragonEggFormEvent.patch')
-rw-r--r--patches/server/0587-add-DragonEggFormEvent.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/patches/server/0587-add-DragonEggFormEvent.patch b/patches/server/0587-add-DragonEggFormEvent.patch
new file mode 100644
index 0000000000..ab3f7fd05b
--- /dev/null
+++ b/patches/server/0587-add-DragonEggFormEvent.patch
@@ -0,0 +1,35 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Trigary <[email protected]>
+Date: Mon, 25 Jan 2021 14:53:57 +0100
+Subject: [PATCH] add DragonEggFormEvent
+
+
+diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+index 088ad331ec088478d85aedd8d4c32eab55e18dc5..7dbe0bc8082c8e7741f40bbd69bc7d7407945754 100644
+--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
++++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+@@ -367,9 +367,23 @@ public class EndDragonFight {
+ this.dragonEvent.setVisible(false);
+ this.spawnExitPortal(true);
+ this.spawnNewGateway();
++ // Paper start - DragonEggFormEvent
++ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
++ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
++ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
++ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState,
++ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
++ // Paper end - DragonEggFormEvent
+ if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
+- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
++ // Paper start - DragonEggFormEvent
++ //this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData());
++ } else {
++ eggEvent.setCancelled(true);
++ }
++ if (eggEvent.callEvent()) {
++ eggEvent.getNewState().update(true);
+ }
++ // Paper end - DragonEggFormEvent
+
+ this.previouslyKilled = true;
+ this.dragonKilled = true;