From c7d6428f2823d7c90409a2bf3cd7af6e8d25413d Mon Sep 17 00:00:00 2001 From: Miles Holder Date: Fri, 27 Sep 2024 12:57:36 +1000 Subject: [PATCH] SPIGOT-7856, #1483: End platform not dropping items after replacing blocks --- .../levelgen/feature/EndPlatformFeature.patch | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/nms-patches/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.patch b/nms-patches/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.patch index 125efd65f..f8a04e34b 100644 --- a/nms-patches/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.patch +++ b/nms-patches/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.patch @@ -27,7 +27,7 @@ BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable(); for (int i = -2; i <= 2; ++i) { -@@ -29,16 +42,33 @@ +@@ -29,16 +42,36 @@ BlockPosition.MutableBlockPosition blockposition_mutableblockposition1 = blockposition_mutableblockposition.set(blockposition).move(j, k, i); Block block = k == -1 ? Blocks.OBSIDIAN : Blocks.AIR; @@ -47,19 +47,22 @@ } } + // CraftBukkit start -+ if (entity == null) { -+ // SPIGOT-7746: Entity will only be null during world generation, which is async, so just generate without event -+ blockList.updateList(); -+ return; ++ // SPIGOT-7746: Entity will only be null during world generation, which is async, so just generate without event ++ if (entity != null) { ++ org.bukkit.World bworld = worldaccess.getLevel().getWorld(); ++ PortalCreateEvent portalEvent = new PortalCreateEvent((List) (List) blockList.getList(), bworld, entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM); ++ ++ worldaccess.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent); ++ if (portalEvent.isCancelled()) { ++ return; ++ } + } + -+ org.bukkit.World bworld = worldaccess.getLevel().getWorld(); -+ PortalCreateEvent portalEvent = new PortalCreateEvent((List) (List) blockList.getList(), bworld, entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM); -+ -+ worldaccess.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent); -+ if (!portalEvent.isCancelled()) { -+ blockList.updateList(); ++ // SPIGOT-7856: End platform not dropping items after replacing blocks ++ if (flag) { ++ blockList.getList().forEach((state) -> worldaccess.destroyBlock(state.getPosition(), true, null)); + } ++ blockList.updateList(); + // CraftBukkit end }