mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-01 08:20:51 +01:00
1e7dd72f15
The game uses 0.95d now
36 lines
2.4 KiB
Diff
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 99321471d2c8c154059ebf345c63f8918a4cd75a..c29ccc66c95faba425acb0ca06af15e2783b4bae 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,9 +407,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.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 - 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.getLocation(this.origin)), Blocks.DRAGON_EGG.defaultBlockState());
|
|
+ // Paper start - 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 - DragonEggFormEvent
|
|
|
|
this.previouslyKilled = true;
|
|
this.dragonKilled = true;
|