diff --git a/patches/server/Added-PlayerBedFailEnterEvent.patch b/patches/server/Added-PlayerBedFailEnterEvent.patch index 65a2f0c540..043583048e 100644 --- a/patches/server/Added-PlayerBedFailEnterEvent.patch +++ b/patches/server/Added-PlayerBedFailEnterEvent.patch @@ -14,13 +14,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> { + // Paper start - PlayerBedFailEnterEvent + if (entityhuman_enumbedresult != null) { -+ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); ++ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), !world.dimensionType().bedWorks(), io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); + if (!event.callEvent()) { + return; + } + // Paper end // CraftBukkit start - handling bed explosion from below here -- if (entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE) { +- if (!world.dimensionType().bedWorks()) { + if (event.getWillExplode()) { // Paper this.explodeBed(finaliblockdata, world, finalblockposition); } else diff --git a/patches/server/Duplicate-UUID-Resolve-Option.patch b/patches/server/Duplicate-UUID-Resolve-Option.patch index 135e7cd582..e3c4d25845 100644 --- a/patches/server/Duplicate-UUID-Resolve-Option.patch +++ b/patches/server/Duplicate-UUID-Resolve-Option.patch @@ -178,7 +178,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return false; + } + // Paper end - LOGGER.warn("UUID of added entity already exists: {}", (Object)entity); + PersistentEntitySectionManager.LOGGER.warn("UUID of added entity already exists: {}", entity); + // Paper start + if (net.minecraft.world.level.Level.DEBUG_ENTITIES && ((Entity) entity).level.paperConfig.duplicateUUIDMode != com.destroystokyo.paper.PaperWorldConfig.DuplicateUUIDMode.NOTHING) { + if (((Entity) entity).addedToWorldStack != null) { @@ -190,39 +190,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } else { return true; -@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - } - - private void processUnloads() { -- this.chunksToUnload.removeIf((pos) -> { -+ this.chunksToUnload.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix - return this.chunkVisibility.get(pos) != Visibility.HIDDEN ? true : this.processChunkUnload(pos); - }); - } -@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - } - - public void autoSave() { -- this.getAllChunksToSave().forEach((pos) -> { -+ this.getAllChunksToSave().forEach((java.util.function.LongConsumer) (pos) -> { // Paper - decompile fix - boolean bl = this.chunkVisibility.get(pos) == Visibility.HIDDEN; - if (bl) { - this.processChunkUnload(pos); -@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - while(!longSet.isEmpty()) { - this.permanentStorage.flush(false); - this.processPendingLoads(); -- longSet.removeIf((pos) -> { -+ longSet.removeIf((java.util.function.LongPredicate) (pos) -> { // Paper - decompile fix - boolean bl = this.chunkVisibility.get(pos) == Visibility.HIDDEN; - return bl ? this.processChunkUnload(pos) : this.storeChunkSections(pos, (entityAccess) -> { - }); -@@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - - public void dumpSections(Writer writer) throws IOException { - CsvOutput csvOutput = CsvOutput.builder().addColumn("x").addColumn("y").addColumn("z").addColumn("visibility").addColumn("load_status").addColumn("entity_count").build(writer); -- this.sectionStorage.getAllChunksWithExistingSections().forEach((chunkPos) -> { -+ this.sectionStorage.getAllChunksWithExistingSections().forEach((java.util.function.LongConsumer) (chunkPos) -> { // Paper - decompile fix - PersistentEntitySectionManager.ChunkLoadStatus chunkLoadStatus = this.chunkLoadStatuses.get(chunkPos); - this.sectionStorage.getExistingSectionPositionsInChunk(chunkPos).forEach((sectionPos) -> { - EntitySection entitySection = this.sectionStorage.getSection(sectionPos); diff --git a/patches/server/Fix-bed-handling-for-custom-dimensions.patch b/patches/server/Fix-bed-handling-for-custom-dimensions.patch deleted file mode 100644 index acbc7ecd8a..0000000000 --- a/patches/server/Fix-bed-handling-for-custom-dimensions.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Doc -Date: Fri, 6 Aug 2021 11:23:13 -0400 -Subject: [PATCH] Fix bed handling for custom dimensions - - -diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/level/ServerPlayer.java -+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -0,0 +0,0 @@ public class ServerPlayer extends Player { - // CraftBukkit start - moved bed result checks from below into separate method - private Either getBedResult(BlockPos blockposition, Direction enumdirection) { - if (!this.isSleeping() && this.isAlive()) { -- if (!this.level.dimensionType().natural()) { -+ if (!this.level.dimensionType().natural() || !this.level.dimensionType().bedWorks()) { // Paper - check if dimension allows beds (moved from BedBlock#canSetSpawn) - return Either.left(Player.BedSleepingProblem.NOT_POSSIBLE_HERE); - } else if (!this.bedInRange(blockposition, enumdirection)) { - return Either.left(Player.BedSleepingProblem.TOO_FAR_AWAY); -diff --git a/src/main/java/net/minecraft/world/level/block/BedBlock.java b/src/main/java/net/minecraft/world/level/block/BedBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/block/BedBlock.java -+++ b/src/main/java/net/minecraft/world/level/block/BedBlock.java -@@ -0,0 +0,0 @@ public class BedBlock extends HorizontalDirectionalBlock implements EntityBlock - player.startSleepInBed(pos).ifLeft((entityhuman_enumbedresult) -> { - // Paper start - PlayerBedFailEnterEvent - if (entityhuman_enumbedresult != null) { -- io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), entityhuman_enumbedresult == Player.BedSleepingProblem.NOT_POSSIBLE_HERE, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); -+ boolean bedWillExplode = !world.dimensionType().bedWorks(); // Paper - Handle explode flag -+ io.papermc.paper.event.player.PlayerBedFailEnterEvent event = new io.papermc.paper.event.player.PlayerBedFailEnterEvent((org.bukkit.entity.Player) player.getBukkitEntity(), io.papermc.paper.event.player.PlayerBedFailEnterEvent.FailReason.VALUES[entityhuman_enumbedresult.ordinal()], org.bukkit.craftbukkit.block.CraftBlock.at(world, finalblockposition), bedWillExplode, io.papermc.paper.adventure.PaperAdventure.asAdventure(entityhuman_enumbedresult.getMessage())); // Paper - if (!event.callEvent()) { - return; - } diff --git a/patches/server/Optimise-TickListServer-by-rewriting-it.patch b/patches/server/Optimise-TickListServer-by-rewriting-it.patch index 5a00d081b1..a8e05b2690 100644 --- a/patches/server/Optimise-TickListServer-by-rewriting-it.patch +++ b/patches/server/Optimise-TickListServer-by-rewriting-it.patch @@ -1123,13 +1123,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java +++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - this.addEntity(entity, true); + this.addEntity(entityaccess, true); }); - this.chunkLoadStatuses.put(chunkEntities.getPos().toLong(), PersistentEntitySectionManager.ChunkLoadStatus.LOADED); + this.chunkLoadStatuses.put(chunkentities.getPos().toLong(), PersistentEntitySectionManager.ChunkLoadStatus.LOADED); + // Paper start - rewrite ServerTickList + final net.minecraft.server.level.ServerLevel level = ((net.minecraft.world.level.chunk.storage.EntityStorage) this.permanentStorage).level; -+ if (level.chunkSource.isPositionTickingReady(chunkEntities.getPos().longKey)) { -+ level.onChunkSetTicking(chunkEntities.getPos().x, chunkEntities.getPos().z); ++ if (level.chunkSource.isPositionTickingReady(chunkentities.getPos().longKey)) { ++ level.onChunkSetTicking(chunkentities.getPos().x, chunkentities.getPos().z); + } + // Paper end } diff --git a/patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch b/patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch index d581999919..ba64bfac46 100644 --- a/patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch +++ b/patches/server/Optimize-ServerLevels-chunk-level-checking-methods.patch @@ -60,5 +60,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - public boolean isPositionTicking(BlockPos blockPos) { - return this.chunkVisibility.get(ChunkPos.asLong(blockPos)).isTicking(); + public boolean isPositionTicking(BlockPos blockposition) { + return ((Visibility) this.chunkVisibility.get(ChunkPos.asLong(blockposition))).isTicking(); diff --git a/work/CraftBukkit b/work/CraftBukkit index a0a37f416c..5be41fb80f 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit a0a37f416ca6c9be007f65e1b8ef5efea9b50cb5 +Subproject commit 5be41fb80fa84c15359d271c38b52a1e815ea9f9