diff --git a/patches/unapplied/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/unapplied/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/api/Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/unapplied/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/unapplied/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/api/Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/unapplied/api/Add-missing-effects.patch b/patches/api/Add-missing-effects.patch similarity index 100% rename from patches/unapplied/api/Add-missing-effects.patch rename to patches/api/Add-missing-effects.patch diff --git a/patches/unapplied/api/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/api/Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/unapplied/api/Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/api/Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/unapplied/api/EntityMoveEvent.patch b/patches/api/EntityMoveEvent.patch similarity index 100% rename from patches/unapplied/api/EntityMoveEvent.patch rename to patches/api/EntityMoveEvent.patch diff --git a/patches/unapplied/api/Expose-Tracked-Players.patch b/patches/api/Expose-Tracked-Players.patch similarity index 100% rename from patches/unapplied/api/Expose-Tracked-Players.patch rename to patches/api/Expose-Tracked-Players.patch diff --git a/patches/unapplied/api/add-DragonEggFormEvent.patch b/patches/api/add-DragonEggFormEvent.patch similarity index 100% rename from patches/unapplied/api/add-DragonEggFormEvent.patch rename to patches/api/add-DragonEggFormEvent.patch diff --git a/patches/unapplied/api/living-entity-allow-attribute-registration.patch b/patches/api/living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/unapplied/api/living-entity-allow-attribute-registration.patch rename to patches/api/living-entity-allow-attribute-registration.patch diff --git a/patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch similarity index 100% rename from patches/unapplied/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch rename to patches/server/Add-dropLeash-variable-to-EntityUnleashEvent.patch diff --git a/patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch similarity index 100% rename from patches/unapplied/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch rename to patches/server/Add-getMainThreadExecutor-to-BukkitScheduler.patch diff --git a/patches/unapplied/server/Add-support-for-hex-color-codes-in-console.patch b/patches/server/Add-support-for-hex-color-codes-in-console.patch similarity index 99% rename from patches/unapplied/server/Add-support-for-hex-color-codes-in-console.patch rename to patches/server/Add-support-for-hex-color-codes-in-console.patch index 1eeab1c72f..cb425ecbe0 100644 --- a/patches/unapplied/server/Add-support-for-hex-color-codes-in-console.patch +++ b/patches/server/Add-support-for-hex-color-codes-in-console.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin // Paper end implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper - implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper + implementation("org.ow2.asm:asm:9.2") diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 diff --git a/patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/Allow-adding-items-to-BlockDropItemEvent.patch similarity index 100% rename from patches/unapplied/server/Allow-adding-items-to-BlockDropItemEvent.patch rename to patches/server/Allow-adding-items-to-BlockDropItemEvent.patch diff --git a/patches/unapplied/server/EntityMoveEvent.patch b/patches/server/EntityMoveEvent.patch similarity index 100% rename from patches/unapplied/server/EntityMoveEvent.patch rename to patches/server/EntityMoveEvent.patch diff --git a/patches/unapplied/server/Expose-Tracked-Players.patch b/patches/server/Expose-Tracked-Players.patch similarity index 100% rename from patches/unapplied/server/Expose-Tracked-Players.patch rename to patches/server/Expose-Tracked-Players.patch diff --git a/patches/unapplied/server/Inline-shift-direction-fields.patch b/patches/server/Inline-shift-direction-fields.patch similarity index 100% rename from patches/unapplied/server/Inline-shift-direction-fields.patch rename to patches/server/Inline-shift-direction-fields.patch diff --git a/patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch b/patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch similarity index 76% rename from patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch rename to patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch index d31191d03a..bdb44d9c15 100644 --- a/patches/unapplied/server/Merchant-getRecipes-should-return-an-immutable-list.patch +++ b/patches/server/Merchant-getRecipes-should-return-an-immutable-list.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public List getRecipes() { - return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function() { -+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) ++ return List.copyOf(Lists.transform(this.merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) @Override public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) { return recipe.asBukkit(); diff --git a/patches/unapplied/server/Remove-streams-from-SensorNearest.patch b/patches/server/Remove-streams-from-SensorNearest.patch similarity index 72% rename from patches/unapplied/server/Remove-streams-from-SensorNearest.patch rename to patches/server/Remove-streams-from-SensorNearest.patch index cda6bfea63..63f161e6a9 100644 --- a/patches/unapplied/server/Remove-streams-from-SensorNearest.patch +++ b/patches/server/Remove-streams-from-SensorNearest.patch @@ -44,25 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } } -diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java -@@ -0,0 +0,0 @@ public class NearestLivingEntitySensor extends Sensor { - list.sort(Comparator.comparingDouble(entity::distanceToSqr)); - Brain brain = entity.getBrain(); - brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list); -- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, list.stream().filter((livingEntity2) -> { -- return isEntityTargetable(entity, livingEntity2); -- }).collect(Collectors.toList())); -+ // Paper start - remove streams in favour of lists -+ List visibleMobs = new java.util.ArrayList<>(list); -+ visibleMobs.removeIf(otherEntityLiving -> !Sensor.isEntityTargetable(entity, otherEntityLiving)); -+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, visibleMobs); -+ // Paper end - } - - @Override diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java @@ -71,12 +52,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected void doTick(ServerLevel world, LivingEntity entity) { -- List list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((serverPlayer) -> { -- return entity.closerThan(serverPlayer, 16.0D); +- List list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> { +- return entity.closerThan(player, 16.0D); - }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); -+ // Paper start - remove streams in favour of lists -+ List players = new java.util.ArrayList<>(world.players()); -+ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator ++ List players= new java.util.ArrayList<>(world.players()); ++ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); ++ players.sort(Comparator.comparingDouble(entity::distanceTo)); Brain brain = entity.getBrain(); - brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); - List list2 = list.stream().filter((player) -> { diff --git a/patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch b/patches/server/Reset-shield-blocking-on-dimension-change.patch similarity index 100% rename from patches/unapplied/server/Reset-shield-blocking-on-dimension-change.patch rename to patches/server/Reset-shield-blocking-on-dimension-change.patch diff --git a/patches/unapplied/server/Skip-distance-map-update-when-spawning-disabled.patch b/patches/server/Skip-distance-map-update-when-spawning-disabled.patch similarity index 100% rename from patches/unapplied/server/Skip-distance-map-update-when-spawning-disabled.patch rename to patches/server/Skip-distance-map-update-when-spawning-disabled.patch diff --git a/patches/unapplied/server/add-DragonEggFormEvent.patch b/patches/server/add-DragonEggFormEvent.patch similarity index 91% rename from patches/unapplied/server/add-DragonEggFormEvent.patch rename to patches/server/add-DragonEggFormEvent.patch index 6e1a0ebc83..5f5c2ba6df 100644 --- a/patches/unapplied/server/add-DragonEggFormEvent.patch +++ b/patches/server/add-DragonEggFormEvent.patch @@ -14,10 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.spawnNewGateway(); + // Paper start - DragonEggFormEvent + BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION); -+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition); + 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(eggBlock, eggState, ++ 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.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg diff --git a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch similarity index 93% rename from patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch rename to patches/server/added-option-to-disable-pathfinding-updates-on-block.patch index 9d5406da93..715ee8984c 100644 --- a/patches/unapplied/server/added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch @@ -9,16 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - private void enderDragonsDeathAlwaysPlacesDragonEgg() { enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); } -+ + + public boolean updatePathfindingOnBlockUpdate = true; + private void setUpdatePathfindingOnBlockUpdate() { + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + } - } - ++ + public boolean phantomIgnoreCreative = true; + public boolean phantomOnlyAttackInsomniacs = true; + private void phantomSettings() { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch b/patches/server/fix-dead-slime-setSize-invincibility.patch similarity index 100% rename from patches/unapplied/server/fix-dead-slime-setSize-invincibility.patch rename to patches/server/fix-dead-slime-setSize-invincibility.patch diff --git a/patches/unapplied/server/living-entity-allow-attribute-registration.patch b/patches/server/living-entity-allow-attribute-registration.patch similarity index 100% rename from patches/unapplied/server/living-entity-allow-attribute-registration.patch rename to patches/server/living-entity-allow-attribute-registration.patch