Paper/patches/server/0583-add-DragonEggFormEvent.patch
Nassim Jahnke ef0e5a642d
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
9ae3f10f SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
48c0c547 PR-786: Add methods to get sounds from entities

CraftBukkit Changes:
5cc9c022a SPIGOT-7152: Handle hand item changing during air interact event
4ffa1acf6 SPIGOT-7154: Players get kicked when interacting with a conversation
4daa21123 SPIGOT-3842: Add Player#fireworkBoost() and expand Firework API
e5d6a9bbf PR-1100: Add methods to get sounds from entities
b7e9f1c8b SPIGOT-7146: Reduce use of Material switch in ItemMeta

Spigot Changes:
4c157bb4 Rebuild patches
2022-09-12 13:31:45 +02:00

36 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
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 42dc41311e9bc716dcd88f90cbbf533884bf92a3..99b175625c79fe5c4d944810e3fe11be5eed997f 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
@@ -368,9 +368,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().entities.behavior.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.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION), Blocks.DRAGON_EGG.defaultBlockState());
+ } else {
+ eggEvent.setCancelled(true);
+ }
+ if (eggEvent.callEvent()) {
+ eggEvent.getNewState().update(true);
}
+ // Paper end - DragonEggFormEvent
this.previouslyKilled = true;
this.dragonKilled = true;