Add back more optimization patches

This commit is contained in:
Nassim Jahnke 2024-06-15 19:24:11 +02:00
parent 128085ba3e
commit b81fffb934
15 changed files with 21 additions and 70 deletions

View File

@ -4,11 +4,11 @@ Date: Mon, 8 Apr 2024 16:43:16 +0200
Subject: [PATCH] API for checking sent chunks
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
@@ -0,0 +0,0 @@ public class RegionizedPlayerChunkLoader {
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
@@ -0,0 +0,0 @@ public final class RegionizedPlayerChunkLoader {
// now all tickets should be removed, which is all of our external state
}
@ -18,8 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return this.sentChunks;
+ }
}
// TODO rebase into util patch
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@ -33,18 +32,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public Set<java.lang.Long> getSentChunkKeys() {
+ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks");
+ return it.unimi.dsi.fastutil.longs.LongSets.unmodifiable(
+ this.getHandle().chunkLoader.getSentChunksRaw().clone()
+ this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().clone()
+ );
+ }
+
+ @Override
+ public Set<org.bukkit.Chunk> getSentChunks() {
+ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks");
+ final it.unimi.dsi.fastutil.longs.LongOpenHashSet rawChunkKeys = this.getHandle().chunkLoader.getSentChunksRaw();
+ final it.unimi.dsi.fastutil.longs.LongOpenHashSet rawChunkKeys = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw();
+ final it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<org.bukkit.Chunk> chunks = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(rawChunkKeys.size());
+ final org.bukkit.World world = this.getWorld();
+
+ final it.unimi.dsi.fastutil.longs.LongIterator iter = this.getHandle().chunkLoader.getSentChunksRaw().longIterator();
+ final it.unimi.dsi.fastutil.longs.LongIterator iter = this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().longIterator();
+ while (iter.hasNext()) chunks.add(world.getChunkAt(iter.nextLong(), false));
+
+ return it.unimi.dsi.fastutil.objects.ObjectSets.unmodifiable(chunks);
@ -53,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public boolean isChunkSent(final long chunkKey) {
+ org.spigotmc.AsyncCatcher.catchOp("accessing sent chunks");
+ return this.getHandle().chunkLoader.getSentChunksRaw().contains(chunkKey);
+ return this.getHandle().moonrise$getChunkLoader().getSentChunksRaw().contains(chunkKey);
+ }
+ // Paper end
+

View File

@ -2012,7 +2012,7 @@ 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 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
public final UUID uuid;
public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent
@ -2020,7 +2020,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return crashreportsystemdetails;
}
@ -2038,10 +2038,10 @@ diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return ret;
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
}
}
// Paper end
// Paper end - notify observers even if grow failed
+ // Paper start - optimize redstone (Alternate Current)
+ public alternate.current.wire.WireHandler getWireHandler() {
+ // This method is overridden in ServerLevel.

View File

@ -39,7 +39,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -0,0 +0,0 @@ public class Commands {
private void fillUsableCommands(CommandNode<CommandSourceStack> tree, CommandNode<SharedSuggestionProvider> result, CommandSourceStack source, Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> resultNodes) {
resultNodes.keySet().removeIf((node) -> !org.spigotmc.SpigotConfig.sendNamespaced && node.getName().contains( ":" )); // Paper - Remove namedspaced from result nodes to prevent redirect trimming ~ see comment below
Iterator iterator = tree.getChildren().iterator();
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments

View File

@ -10,9 +10,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
++((ServerPlayer)backingSet[i]).mobCounts[index];
}
}
+ // Paper start - per player mob count backoff
+ public void updateFailurePlayerMobTypeMap(int chunkX, int chunkZ, net.minecraft.world.entity.MobCategory mobCategory) {
+ if (!this.level.paperConfig().entities.spawning.perPlayerMobSpawns) {
@ -33,9 +33,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
public int getMobCountNear(final ServerPlayer player, final net.minecraft.world.entity.MobCategory mobCategory) {
- return player.mobCounts[mobCategory.ordinal()];
+ return player.mobCounts[mobCategory.ordinal()] + player.mobBackoffCounts[mobCategory.ordinal()]; // Paper - per player mob count backoff
// Paper end - Optional per player mob spawns
}
// Paper end - Optional per player mob spawns
// Paper end
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@ -63,7 +63,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
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 {
@@ -0,0 +0,0 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
public static final int MOBCATEGORY_TOTAL_ENUMS = net.minecraft.world.entity.MobCategory.values().length;
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
// Paper end - Optional per player mob spawns

View File

@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -0,0 +0,0 @@ dependencies {
runtimeOnly("org.xerial:sqlite-jdbc:3.45.3.0")
runtimeOnly("com.mysql:mysql-connector-j:8.3.0")
runtimeOnly("org.xerial:sqlite-jdbc:3.46.0.0")
runtimeOnly("com.mysql:mysql-connector-j:8.4.0")
runtimeOnly("com.lmax:disruptor:3.4.4") // Paper
+ // Paper start - Use Velocity cipher
+ implementation("com.velocitypowered:velocity-native:3.1.2-SNAPSHOT") {

View File

@ -1,48 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <nassim@njahnke.dev>
Date: Fri, 14 Jun 2024 17:19:59 +0200
Subject: [PATCH] stubs
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -0,0 +0,0 @@ import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import org.bukkit.BanEntry;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
@@ -0,0 +0,0 @@ import org.bukkit.scoreboard.Scoreboard;
import org.jetbrains.annotations.NotNull;
import net.md_5.bungee.api.chat.BaseComponent; // Spigot
+import org.jetbrains.annotations.Unmodifiable;
@DelegateDeserialization(CraftOfflinePlayer.class)
public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetIdleDuration() {
this.getHandle().resetLastActionTime();
}
+
+ @Override
+ public @NotNull @Unmodifiable Set<Long> getSentChunkKeys() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public @NotNull @Unmodifiable Set<Chunk> getSentChunks() {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
+
+ @Override
+ public boolean isChunkSent(final long chunkKey) {
+ throw new UnsupportedOperationException("Not implemented yet");
+ }
// Paper end
public Player.Spigot spigot()