diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch new file mode 100644 index 0000000000..bfd494df87 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch @@ -0,0 +1,52 @@ +--- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java ++++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java +@@ -19,6 +_,12 @@ + } + + public static void createEndPlatform(ServerLevelAccessor level, BlockPos pos, boolean dropBlocks) { ++ // CraftBukkit start ++ createEndPlatform(level, pos, dropBlocks, null); ++ } ++ public static void createEndPlatform(ServerLevelAccessor level, BlockPos pos, boolean dropBlocks, net.minecraft.world.entity.Entity entity) { ++ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(level); ++ // CraftBukkit end + BlockPos.MutableBlockPos mutableBlockPos = pos.mutable(); + + for (int i = -2; i <= 2; i++) { +@@ -26,15 +_,33 @@ + for (int i2 = -1; i2 < 3; i2++) { + BlockPos blockPos = mutableBlockPos.set(pos).move(i1, i2, i); + Block block = i2 == -1 ? Blocks.OBSIDIAN : Blocks.AIR; +- if (!level.getBlockState(blockPos).is(block)) { ++ // CraftBukkit start ++ if (!blockList.getBlockState(blockPos).is(block)) { + if (dropBlocks) { +- level.destroyBlock(blockPos, true, null); ++ blockList.destroyBlock(blockPos, true, null); + } + +- level.setBlock(blockPos, block.defaultBlockState(), 3); ++ blockList.setBlock(blockPos, block.defaultBlockState(), 3); ++ // CraftBukkit end + } + } + } + } ++ ++ // CraftBukkit start ++ // 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 = level.getLevel().getWorld(); ++ org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((java.util.List) (java.util.List) blockList.getList(), bworld, entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM); ++ level.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent); ++ if (portalEvent.isCancelled()) return; ++ } ++ ++ // SPIGOT-7856: End platform not dropping items after replacing blocks ++ if (dropBlocks) { ++ blockList.getList().forEach((state) -> level.destroyBlock(state.getPosition(), true, null)); ++ } ++ blockList.updateList(); ++ // CraftBukkit end + } + } diff --git a/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch new file mode 100644 index 0000000000..9de3934ace --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch @@ -0,0 +1,10 @@ +--- a/net/minecraft/world/level/levelgen/feature/SpikeFeature.java ++++ b/net/minecraft/world/level/levelgen/feature/SpikeFeature.java +@@ -113,6 +_,7 @@ + endCrystal.setBeamTarget(config.getCrystalBeamTarget()); + endCrystal.setInvulnerable(config.isCrystalInvulnerable()); + endCrystal.moveTo(spike.getCenterX() + 0.5, spike.getHeight() + 1, spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F); ++ endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals + level.addFreshEntity(endCrystal); + BlockPos blockPosx = endCrystal.blockPosition(); + this.setBlock(level, blockPosx.below(), Blocks.BEDROCK.defaultBlockState()); diff --git a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch b/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch deleted file mode 100644 index d2cdde6d47..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java -@@ -7,6 +7,11 @@ - import net.minecraft.world.level.block.Block; - import net.minecraft.world.level.block.Blocks; - import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration; -+// CraftBukkit start -+import java.util.List; -+import org.bukkit.block.BlockState; -+import org.bukkit.event.world.PortalCreateEvent; -+// CraftBukkit end - - public class EndPlatformFeature extends Feature { - -@@ -21,24 +26,51 @@ - } - - public static void createEndPlatform(ServerLevelAccessor world, BlockPos pos, boolean breakBlocks) { -- BlockPos.MutableBlockPos blockposition_mutableblockposition = pos.mutable(); -+ EndPlatformFeature.createEndPlatform(world, pos, breakBlocks, null); -+ // CraftBukkit start -+ } - -+ public static void createEndPlatform(ServerLevelAccessor worldaccess, BlockPos blockposition, boolean flag, Entity entity) { -+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldaccess); -+ // CraftBukkit end -+ BlockPos.MutableBlockPos blockposition_mutableblockposition = blockposition.mutable(); -+ - for (int i = -2; i <= 2; ++i) { - for (int j = -2; j <= 2; ++j) { - for (int k = -1; k < 3; ++k) { -- BlockPos.MutableBlockPos blockposition_mutableblockposition1 = blockposition_mutableblockposition.set(pos).move(j, k, i); -+ BlockPos.MutableBlockPos blockposition_mutableblockposition1 = blockposition_mutableblockposition.set(blockposition).move(j, k, i); - Block block = k == -1 ? Blocks.OBSIDIAN : Blocks.AIR; - -- if (!world.getBlockState(blockposition_mutableblockposition1).is(block)) { -- if (breakBlocks) { -- world.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); -+ // CraftBukkit start -+ if (!blockList.getBlockState(blockposition_mutableblockposition1).is(block)) { -+ if (flag) { -+ blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); - } - -- world.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3); -+ blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3); -+ // CraftBukkit end - } - } - } - } -+ // CraftBukkit start -+ // 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; -+ } -+ } -+ -+ // 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 -+ - } - } diff --git a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch b/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch deleted file mode 100644 index 3db119d7ed..0000000000 --- a/paper-server/patches/unapplied/net/minecraft/world/level/levelgen/feature/SpikeFeature.java.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -+++ b/net/minecraft/world/level/levelgen/feature/SpikeFeature.java -@@ -115,6 +115,7 @@ - endCrystal.moveTo( - (double)spike.getCenterX() + 0.5, (double)(spike.getHeight() + 1), (double)spike.getCenterZ() + 0.5, random.nextFloat() * 360.0F, 0.0F - ); -+ endCrystal.generatedByDragonFight = true; // Paper - Fix invulnerable end crystals - world.addFreshEntity(endCrystal); - BlockPos blockPos2 = endCrystal.blockPosition(); - this.setBlock(world, blockPos2.below(), Blocks.BEDROCK.defaultBlockState());