aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch
diff options
context:
space:
mode:
authorKyle Wood <[email protected]>2021-04-24 17:01:33 -0500
committerKyle Wood <[email protected]>2021-04-25 18:37:43 -0500
commit3093b81fee3064603c368ab934eddf66ce304433 (patch)
treecb99f05b5f31de92c41af4cc40b4bef5f3cbf573 /Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch
parent1af696a05d21cbdd7b5a7170f95598c013257588 (diff)
downloadPaper-3093b81fee3064603c368ab934eddf66ce304433.tar.gz
Paper-3093b81fee3064603c368ab934eddf66ce304433.zip
Move patches
Diffstat (limited to 'Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch')
-rw-r--r--Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch66
1 files changed, 66 insertions, 0 deletions
diff --git a/Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch b/Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch
new file mode 100644
index 0000000000..609439176d
--- /dev/null
+++ b/Spigot-Server-Patches-Unmapped/0665-add-DragonEggFormEvent.patch
@@ -0,0 +1,66 @@
+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/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java
+index 80fcceec519ef59d057d27a81fcd0649a20447da..0ab6319aa3e4e1f5679f37be36999ca56ca2484c 100644
+--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java
++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java
+@@ -57,6 +57,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature
+ import net.minecraft.world.phys.AxisAlignedBB;
+ import org.apache.logging.log4j.LogManager;
+ import org.apache.logging.log4j.Logger;
++import io.papermc.paper.event.block.DragonEggFormEvent; // Paper - DragonEggFormEvent
+
+ public class EnderDragonBattle {
+
+@@ -400,9 +401,24 @@ public class EnderDragonBattle {
+ this.bossBattle.setVisible(false);
+ this.generateExitPortal(true);
+ this.n();
++ // Paper start - DragonEggFormEvent
++ BlockPosition eggPosition = this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.getPosition());
++ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.world, eggPosition);
++ org.bukkit.craftbukkit.block.CraftBlockState eggState = new org.bukkit.craftbukkit.block.CraftBlockState(eggBlock);
++ eggState.setData(Blocks.DRAGON_EGG.getBlockData());
++ DragonEggFormEvent eggEvent = new DragonEggFormEvent(eggBlock, eggState,
++ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
++ // Paper end - DragonEggFormEvent
+ if (this.world.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg
+- this.world.setTypeUpdate(this.world.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, WorldGenEndTrophy.a), Blocks.DRAGON_EGG.getBlockData());
++ // 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;
+diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java
+index 18395a3b4a7df1c99e952b9c8e738f165648eba5..851b8c2a86d7155278b49c44c6db8b1cbd2065f2 100644
+--- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java
++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java
+@@ -14,7 +14,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature
+
+ public class WorldGenEndTrophy extends WorldGenerator<WorldGenFeatureEmptyConfiguration> {
+
+- public static final BlockPosition a = BlockPosition.ZERO;
++ public static final BlockPosition a = BlockPosition.ZERO; public static BlockPosition getPosition() { return a; } // Paper - OBFHELPER
+ private final boolean ab;
+
+ public WorldGenEndTrophy(boolean flag) {
+@@ -22,7 +22,7 @@ public class WorldGenEndTrophy extends WorldGenerator<WorldGenFeatureEmptyConfig
+ this.ab = flag;
+ }
+
+- public boolean a(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) {
++ public boolean generate(GeneratorAccessSeed generatoraccessseed, ChunkGenerator chunkgenerator, Random random, BlockPosition blockposition, WorldGenFeatureEmptyConfiguration worldgenfeatureemptyconfiguration) { // Paper - decompile fix
+ Iterator iterator = BlockPosition.a(new BlockPosition(blockposition.getX() - 4, blockposition.getY() - 1, blockposition.getZ() - 4), new BlockPosition(blockposition.getX() + 4, blockposition.getY() + 32, blockposition.getZ() + 4)).iterator();
+
+ while (iterator.hasNext()) {