3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00
Paper/patches/server/0479-Add-DragonEggFormEvent.patch

35 Zeilen
2.4 KiB
Diff

2021-06-14 21:58:32 +02:00
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
2021-06-14 21:58:32 +02:00
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
2024-10-23 19:46:06 +02:00
index 0e1eceb2b83aaafccbb5d58cf5098cfbc6f25a54..3d1a49d865e17a61ff74c6fe0efbd908447ee730 100644
2021-06-14 21:58:32 +02:00
--- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
+++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java
2024-10-23 19:46:06 +02:00
@@ -410,8 +410,22 @@ public class EndDragonFight {
2021-06-14 21:58:32 +02:00
this.dragonEvent.setVisible(false);
this.spawnExitPortal(true);
this.spawnNewGateway();
+ // Paper start - Add DragonEggFormEvent
2023-06-08 02:54:54 +02:00
+ 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);
2021-06-14 21:58:32 +02:00
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
2021-11-24 20:33:17 +01:00
+ 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
2023-06-08 02:54:54 +02:00
- this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
+ // Paper start - Add DragonEggFormEvent
2023-06-08 02:54:54 +02:00
+ // this.level.setBlockAndUpdate(this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
2021-06-14 21:58:32 +02:00
+ } else {
+ eggEvent.setCancelled(true);
2023-03-23 22:57:03 +01:00
+ }
2021-06-14 21:58:32 +02:00
+ if (eggEvent.callEvent()) {
+ eggEvent.getNewState().update(true);
+ // Paper end - Add DragonEggFormEvent
2023-03-23 22:57:03 +01:00
}
2021-06-14 21:58:32 +02:00
this.previouslyKilled = true;