aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0508-Add-DragonEggFormEvent.patch
diff options
context:
space:
mode:
authorOwen <[email protected]>2024-03-03 17:05:34 -0500
committerGitHub <[email protected]>2024-03-03 17:05:34 -0500
commit89d51d5f298cd25d6f44388970596c6780b5664b (patch)
tree07f41f4ce7bc466ea5e35faa2575d0ec6f6c4a76 /patches/server/0508-Add-DragonEggFormEvent.patch
parentb21eb4d9a4d0d0bea857675e2186657592df548e (diff)
downloadPaper-89d51d5f298cd25d6f44388970596c6780b5664b.tar.gz
Paper-89d51d5f298cd25d6f44388970596c6780b5664b.zip
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable. It should be noted that this decision does not promise all future exploits will be configurable.
Diffstat (limited to 'patches/server/0508-Add-DragonEggFormEvent.patch')
-rw-r--r--patches/server/0508-Add-DragonEggFormEvent.patch34
1 files changed, 34 insertions, 0 deletions
diff --git a/patches/server/0508-Add-DragonEggFormEvent.patch b/patches/server/0508-Add-DragonEggFormEvent.patch
new file mode 100644
index 0000000000..b92df234cd
--- /dev/null
+++ b/patches/server/0508-Add-DragonEggFormEvent.patch
@@ -0,0 +1,34 @@
+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 45b7efc85f2ec17288cad329c3a78483903c0ea2..1c9bfcf595bcb247c3b9ffe8b0e0cfee0d0ba91f 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
+@@ -407,8 +407,22 @@ public class EndDragonFight {
+ this.dragonEvent.setVisible(false);
+ this.spawnExitPortal(true);
+ this.spawnNewGateway();
++ // Paper start - Add DragonEggFormEvent
++ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin));
++ 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 - Add DragonEggFormEvent
+ if (this.level.paperConfig().entities.behavior.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - Add toggle for always placing the dragon egg
+- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
++ // Paper start - Add DragonEggFormEvent
++ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
++ } else {
++ eggEvent.setCancelled(true);
++ }
++ if (eggEvent.callEvent()) {
++ eggEvent.getNewState().update(true);
++ // Paper end - Add DragonEggFormEvent
+ }
+
+ this.previouslyKilled = true;