From 0e985b7b3b669366dcfc0261bbdff7be332dc24a Mon Sep 17 00:00:00 2001 From: Nassim Jahnke <nassim@njahnke.dev> Date: Fri, 10 Dec 2021 15:24:07 +0100 Subject: [PATCH] Update to 1.18.1 (#7076) --- build.gradle.kts | 2 +- gradle.properties | 4 +-- patches/api/Convert-project-to-Gradle.patch | 2 +- ...ing-of-PlayerChangeBeaconEffectEvent.patch | 1 + patches/server/Adventure.patch | 4 +-- patches/server/Anti-Xray.patch | 2 +- .../server/Do-not-copy-visible-chunks.patch | 2 +- .../server/Don-t-disable-log4j-lookups.patch | 19 ----------- .../server/Entity-Activation-Range-2.0.patch | 8 ----- patches/server/MC-Utils.patch | 10 +----- .../server/Optimise-WorldServer-notify.patch | 32 +++++++++++++------ ...-PlayerChunkMap-adds-crashing-server.patch | 4 +-- patches/server/Setup-Gradle-project.patch | 2 +- ...pdate-itemstack-legacy-name-and-lore.patch | 4 +-- ...disable-pathfinding-updates-on-block.patch | 4 +-- work/Bukkit | 2 +- work/CraftBukkit | 2 +- work/Spigot | 2 +- 18 files changed, 43 insertions(+), 63 deletions(-) delete mode 100644 patches/server/Don-t-disable-log4j-lookups.patch diff --git a/build.gradle.kts b/build.gradle.kts index 796cd83277..4d72246c80 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -46,7 +46,7 @@ repositories { } dependencies { - paramMappings("net.fabricmc:yarn:1.18+build.1:mergedv2") + paramMappings("net.fabricmc:yarn:1.18.1+build.1:mergedv2") remapper("net.fabricmc:tiny-remapper:0.7.0:fat") decompiler("net.minecraftforge:forgeflower:1.5.498.22") paperclip("io.papermc:paperclip:3.0.2") diff --git a/gradle.properties b/gradle.properties index 7d23481854..a0297b8e1f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ group=io.papermc.paper -version=1.18-R0.1-SNAPSHOT +version=1.18.1-R0.1-SNAPSHOT -mcVersion=1.18 +mcVersion=1.18.1 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/api/Convert-project-to-Gradle.patch b/patches/api/Convert-project-to-Gradle.patch index f919375388..208602b923 100644 --- a/patches/api/Convert-project-to-Gradle.patch +++ b/patches/api/Convert-project-to-Gradle.patch @@ -110,7 +110,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - - <groupId>org.spigotmc</groupId> - <artifactId>spigot-api</artifactId> -- <version>1.18-R0.1-SNAPSHOT</version> +- <version>1.18.1-R0.1-SNAPSHOT</version> - <packaging>jar</packaging> - - <name>Spigot-API</name> diff --git a/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch index 53a437635b..dba6a63c99 100644 --- a/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/patches/server/Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -21,6 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.beaconData.set(2, event.getSecondary() == null ? 0 : event.getSecondary().getId()); + if (!event.willConsumeItem()) return; this.paymentSlot.remove(1); + this.access.execute(Level::blockEntityChanged); + } + // Paper end } diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index 7a9ffb88fd..bf5280f2ba 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -1895,9 +1895,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -0,0 +0,0 @@ public class Main { - public static void main(String[] args) { - System.setProperty("log4j2.formatMsgNoLookups", "true"); + public static boolean useConsole = true; + public static void main(String[] args) { + // Paper start + final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected"); + if (false && System.getProperty(warnWhenLegacyFormattingDetected) == null) { diff --git a/patches/server/Anti-Xray.patch b/patches/server/Anti-Xray.patch index f934762586..e7e97f64d7 100644 --- a/patches/server/Anti-Xray.patch +++ b/patches/server/Anti-Xray.patch @@ -1146,7 +1146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + MutableObject<java.util.Map<Object, ClientboundLevelChunkWithLightPacket>> mutableobject = new MutableObject<>(); // Paper - Anti-Xray - Bypass this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { - boolean flag = ChunkMap.isChunkInEuclideanRange(chunkcoordintpair, entityplayer, true, k); + SectionPos sectionposition = entityplayer.getLastSectionPos(); @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } diff --git a/patches/server/Do-not-copy-visible-chunks.patch b/patches/server/Do-not-copy-visible-chunks.patch index 0946f4cda0..96b59e6079 100644 --- a/patches/server/Do-not-copy-visible-chunks.patch +++ b/patches/server/Do-not-copy-visible-chunks.patch @@ -143,7 +143,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.viewDistance = j; - this.distanceManager.updatePlayerTickets(this.viewDistance); + this.distanceManager.updatePlayerTickets(this.viewDistance + 1); - ObjectIterator objectiterator = this.updatingChunkMap.values().iterator(); + Iterator objectiterator = this.updatingChunks.getVisibleValuesCopy().iterator(); // Paper diff --git a/patches/server/Don-t-disable-log4j-lookups.patch b/patches/server/Don-t-disable-log4j-lookups.patch deleted file mode 100644 index 58d2ef32ac..0000000000 --- a/patches/server/Don-t-disable-log4j-lookups.patch +++ /dev/null @@ -1,19 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Nassim Jahnke <nassim@njahnke.dev> -Date: Thu, 9 Dec 2021 21:59:08 +0100 -Subject: [PATCH] Don't disable log4j lookups - - -diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/org/bukkit/craftbukkit/Main.java -+++ b/src/main/java/org/bukkit/craftbukkit/Main.java -@@ -0,0 +0,0 @@ public class Main { - public static boolean useConsole = true; - - public static void main(String[] args) { -- System.setProperty("log4j2.formatMsgNoLookups", "true"); -+ //System.setProperty("log4j2.formatMsgNoLookups", "true"); // Paper - no... - - // Paper start - final String warnWhenLegacyFormattingDetected = String.join(".", "net", "kyori", "adventure", "text", "warnWhenLegacyFormattingDetected"); diff --git a/patches/server/Entity-Activation-Range-2.0.patch b/patches/server/Entity-Activation-Range-2.0.patch index f26c373e39..e2f38eb3b7 100644 --- a/patches/server/Entity-Activation-Range-2.0.patch +++ b/patches/server/Entity-Activation-Range-2.0.patch @@ -25,14 +25,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.collect.Lists; import com.mojang.datafixers.DataFixer; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.longs.LongSets; - import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; --import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.ObjectIterator; - import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; - import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { ++TimingHistory.entityTicks; // Paper - timings // Spigot start diff --git a/patches/server/MC-Utils.patch b/patches/server/MC-Utils.patch index 4987c52607..c5117d9b34 100644 --- a/patches/server/MC-Utils.patch +++ b/patches/server/MC-Utils.patch @@ -5434,7 +5434,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.removePlayerFromDistanceMaps(player); // Paper - distance maps } - for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) { + for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) { @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } } @@ -5878,14 +5878,6 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.longs.LongSets; - import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -+import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.ObjectIterator; - import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; - import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; @@ -0,0 +0,0 @@ import org.bukkit.event.server.MapInitializeEvent; import org.bukkit.event.weather.LightningStrikeEvent; import org.bukkit.event.world.TimeSkipEvent; diff --git a/patches/server/Optimise-WorldServer-notify.patch b/patches/server/Optimise-WorldServer-notify.patch index e01488cd65..ebc6c5272a 100644 --- a/patches/server/Optimise-WorldServer-notify.patch +++ b/patches/server/Optimise-WorldServer-notify.patch @@ -122,9 +122,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (currentlyTickingEntity.get() == null) { currentlyTickingEntity.lazySet(entity); @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - VoxelShape voxelshape1 = newState.getCollisionShape(this, pos); if (Shapes.joinIsNotEmpty(voxelshape, voxelshape1, BooleanOp.NOT_SAME)) { + List<PathNavigation> list = new ObjectArrayList(); - Iterator iterator = this.navigatingMobs.iterator(); + // Paper start - optimise notify() + io.papermc.paper.chunk.SingleThreadChunkRegionManager.Region region = this.getChunkSource().chunkMap.dataRegionManager.getRegion(pos.getX() >> 4, pos.getZ() >> 4); @@ -138,14 +138,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet.Iterator<Mob> iterator = navigatorsFromRegion.iterator(); - while (iterator.hasNext()) { -+ + try { while (iterator.hasNext()) { // Paper end - optimise notify() // CraftBukkit start - fix SPIGOT-6362 Mob entityinsentient; try { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - navigationabstract.recomputePath(pos); + + try { + this.isUpdatingNavigations = true; +- iterator = list.iterator(); ++ // Paper start - optimise notify() ++ Iterator<PathNavigation> navigationIterator = list.iterator(); + +- while (iterator.hasNext()) { +- PathNavigation navigationabstract1 = (PathNavigation) iterator.next(); ++ while (navigationIterator.hasNext()) { ++ PathNavigation navigationabstract1 = navigationIterator.next(); ++ // Paper end - optimise notify() + + navigationabstract1.recomputePath(); } + } finally { + this.isUpdatingNavigations = false; } + // Paper start - optimise notify() + } finally { @@ -205,14 +219,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.mob = mob; this.level = world; @@ -0,0 +0,0 @@ public abstract class PathNavigation { - } - - public void recomputePath(BlockPos pos) { -- if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { -+ if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { // Paper - diff on change - needed for isViableForPathRecalculationChecking() + public boolean shouldRecomputePath(BlockPos pos) { + if (this.hasDelayedRecomputation) { + return false; +- } else if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { ++ } else if (this.path != null && !this.path.isDone() && this.path.getNodeCount() != 0) { // Paper - diff on change - needed for isViableForPathRecalculationChecking() Node node = this.path.getEndNode(); Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0D, ((double)node.y + this.mob.getY()) / 2.0D, ((double)node.z + this.mob.getZ()) / 2.0D); - if (pos.closerThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex()))) { + return pos.closerThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java diff --git a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index ed241e2bec..f27aa015b4 100644 --- a/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/patches/server/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -36,8 +36,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - ServerLevel.this.getChunkSource().addEntity(entity); + // ServerLevel.this.getChunkSource().addEntity(entity); // Paper - moved down below valid=true if (entity instanceof ServerPlayer) { - ServerLevel.this.players.add((ServerPlayer) entity); - ServerLevel.this.updateSleepingPlayerList(); + ServerPlayer entityplayer = (ServerPlayer) entity; + @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { } diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index ea0a7624f3..8bfaa47ecf 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -185,7 +185,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - <groupId>org.spigotmc</groupId> - <artifactId>spigot</artifactId> - <packaging>jar</packaging> -- <version>1.18-R0.1-SNAPSHOT</version> +- <version>1.18.1-R0.1-SNAPSHOT</version> - <name>Spigot</name> - <url>https://www.spigotmc.org/</url> - diff --git a/patches/server/Update-itemstack-legacy-name-and-lore.patch b/patches/server/Update-itemstack-legacy-name-and-lore.patch index 1cbc2a57de..6c68a0cef0 100644 --- a/patches/server/Update-itemstack-legacy-name-and-lore.patch +++ b/patches/server/Update-itemstack-legacy-name-and-lore.patch @@ -21,7 +21,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (json != null && json.contains("\u00A7")) { + try { + display.put("Name", convert(json)); -+ } catch (JsonParseException jsonparseexception) { ++ } catch (com.google.gson.JsonParseException jsonparseexception) { + display.remove("Name"); + } + } @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (json != null && json.contains("\u00A7")) { // Only try if it has legacy in the unparsed json + try { + list.set(index, convert(json)); -+ } catch (JsonParseException e) { ++ } catch (com.google.gson.JsonParseException e) { + list.set(index, net.minecraft.nbt.StringTag.valueOf(org.bukkit.craftbukkit.util.CraftChatMessage.toJSON(new TextComponent("")))); + } + } diff --git a/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch index 715ee8984c..f0aac1e9b6 100644 --- a/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch +++ b/patches/server/added-option-to-disable-pathfinding-updates-on-block.patch @@ -25,8 +25,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { - @Override - public void sendBlockUpdated(BlockPos pos, BlockState oldState, BlockState newState, int flags) { + } + this.getChunkSource().blockChanged(pos); + if(this.paperConfig.updatePathfindingOnBlockUpdate) { // Paper - option to disable pathfinding updates VoxelShape voxelshape = oldState.getCollisionShape(this, pos); diff --git a/work/Bukkit b/work/Bukkit index ffd8b28939..5906bed05d 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit ffd8b28939b4ec84855f8a10c93463ec113def13 +Subproject commit 5906bed05d29c64af69983e2521cc3e9060d95ec diff --git a/work/CraftBukkit b/work/CraftBukkit index 35d3986e9e..c2e0bbda4e 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 35d3986e9ec4ffba0f025897ae87cd5991b9fa9a +Subproject commit c2e0bbda4ee13ec92c603a7bfe9bd8e5575a2993 diff --git a/work/Spigot b/work/Spigot index dbf493829e..f65de01fa8 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit dbf493829eb4bf37ff6492e725058424138cc651 +Subproject commit f65de01fa82909bd90444c24e49436771663e9c3