several more patches

This commit is contained in:
Jake 2021-11-23 15:56:42 -08:00 committed by MiniDigger | Martin
parent 28b02df594
commit 18ad44eabc
10 changed files with 30 additions and 38 deletions

View File

@ -11,7 +11,7 @@ If the projectile fails to find the shooter in the current world, check
other worlds.
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
index daa55eed9cf385c7e2cdd0a5dceaf0a719652213..458a70f6e76eba707b890c78cbfd4f967eaf8a1b 100644
index 1382a16d21133b368158914509eb9ef3e0694ffd..47d27f95bdd4d556f1750e7ad8493248ba63888a 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -57,6 +57,18 @@ public abstract class Projectile extends Entity {

View File

@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..41d73aa91fb401612e087aa1b7278ba6
+ }
+}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 39bdda56aaa5503efc15207261634127b462c3e7..3fd913f3e963cf2da849a52364356e3b2da11eee 100644
index 90ce56c5b7937e8fd28da6d68448679094308c6e..2bd6241243d2fb49c91daefdec72ac573300473f 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -18,6 +18,7 @@ import javax.crypto.Cipher;
@ -155,7 +155,7 @@ index 39bdda56aaa5503efc15207261634127b462c3e7..3fd913f3e963cf2da849a52364356e3b
public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
this.state = ServerLoginPacketListenerImpl.State.HELLO;
@@ -233,6 +236,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -234,6 +237,14 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
this.state = ServerLoginPacketListenerImpl.State.KEY;
this.connection.send(new ClientboundHelloPacket("", this.server.getKeyPair().getPublic().getEncoded(), this.nonce));
} else {
@ -170,7 +170,7 @@ index 39bdda56aaa5503efc15207261634127b462c3e7..3fd913f3e963cf2da849a52364356e3b
// Spigot start
// Paper start - Cache authenticator threads
authenticatorPool.execute(new Runnable() {
@@ -334,6 +345,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -335,6 +346,12 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
public class LoginHandler {
public void fireEvents() throws Exception {
@ -183,7 +183,7 @@ index 39bdda56aaa5503efc15207261634127b462c3e7..3fd913f3e963cf2da849a52364356e3b
String playerName = ServerLoginPacketListenerImpl.this.gameProfile.getName();
java.net.InetAddress address = ((java.net.InetSocketAddress) ServerLoginPacketListenerImpl.this.connection.getRemoteAddress()).getAddress();
java.util.UUID uniqueId = ServerLoginPacketListenerImpl.this.gameProfile.getId();
@@ -381,6 +398,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
@@ -382,6 +399,40 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
// Spigot end
public void handleCustomQueryPacket(ServerboundCustomQueryPacket packet) {
@ -225,10 +225,10 @@ index 39bdda56aaa5503efc15207261634127b462c3e7..3fd913f3e963cf2da849a52364356e3b
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index d62c4092737b8dc3973a67377a56370f1f27e0cb..921128242ba133d73d2ac592a5f4b7515ef2e46c 100644
index 26c7c5c51c60086957db57e9fdc256e3940e9c39..41de977650b5b6ebb8120d31f5106342189e4a59 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -703,7 +703,7 @@ public final class CraftServer implements Server {
@@ -712,7 +712,7 @@ public final class CraftServer implements Server {
@Override
public long getConnectionThrottle() {
// Spigot Start - Automatically set connection throttle for bungee configurations

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API
diff --git a/src/main/java/net/minecraft/world/entity/monster/Witch.java b/src/main/java/net/minecraft/world/entity/monster/Witch.java
index 94bd20db7ffea00579225e6887b8c78a3da3ff1a..365354910047631b0a4402f29ad156e6447c2606 100644
index 75c863c2cf365c321e401e05f564518be3a7b949..43e4562dcb0de8db42ff556134f649b5e0aa4284 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Witch.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Witch.java
@@ -1,5 +1,8 @@
@ -17,7 +17,7 @@ index 94bd20db7ffea00579225e6887b8c78a3da3ff1a..365354910047631b0a4402f29ad156e6
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
@@ -157,21 +160,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -156,21 +159,24 @@ public class Witch extends Raider implements RangedAttackMob {
}
if (potionregistry != null) {
@ -54,7 +54,7 @@ index 94bd20db7ffea00579225e6887b8c78a3da3ff1a..365354910047631b0a4402f29ad156e6
}
}
@@ -183,6 +189,24 @@ public class Witch extends Raider implements RangedAttackMob {
@@ -182,6 +188,24 @@ public class Witch extends Raider implements RangedAttackMob {
super.aiStep();
}

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Check Drowned for Villager Aggression Config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 58372e9dc3d9ed751feca0cebf2306587f418ebb..8a9a9bfa95db08d063a6409f2e4cf2aa26ec3b0b 100644
index 0a458a88c21c8eece3b08cf7f5d7533efcd879f1..ccaa50d1ba9151bd94333b6b8fc0e77bc4324990 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -79,7 +79,7 @@ public class Drowned extends Zombie implements RangedAttackMob {

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add option to prevent players from moving into unloaded
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 29703f57969b80e25ff9a4971e640f34fb212edf..84b0304c538766949990f26f1e4a792a633f67f4 100644
index 7c538eba5d7e0112aae4c1584172233a3217ae89..a5da82e0dea8a1ac5699179639fbd9ebe7b6e220 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -431,4 +431,9 @@ public class PaperWorldConfig {
@@ -426,4 +426,9 @@ public class PaperWorldConfig {
waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5);
log("Water over lava flow speed: " + waterOverLavaFlowSpeed);
}
@ -20,10 +20,10 @@ index 29703f57969b80e25ff9a4971e640f34fb212edf..84b0304c538766949990f26f1e4a792a
+ }
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index cec99a9e7ab4efef9e7eda723821e9d7bf854946..00a12243a2981903653825edb507b96eb646fd47 100644
index 7ed73ea4a5f7383c953ee3e28ce8f234d8ff941e..26ca0db447a76c3028dacf96bf9afd3b735bda74 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -531,6 +531,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -530,6 +530,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
}
speed *= 2f; // TODO: Get the speed of the vehicle instead of the player
@ -37,7 +37,7 @@ index cec99a9e7ab4efef9e7eda723821e9d7bf854946..00a12243a2981903653825edb507b96e
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
// CraftBukkit end
ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getName().getString(), this.player.getName().getString(), d6, d7, d8);
@@ -1155,9 +1162,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1154,9 +1161,9 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
float prevYaw = this.player.getYRot();
float prevPitch = this.player.getXRot();
// CraftBukkit end
@ -49,7 +49,7 @@ index cec99a9e7ab4efef9e7eda723821e9d7bf854946..00a12243a2981903653825edb507b96e
double d6 = this.player.getY();
double d7 = d0 - this.firstGoodX;
double d8 = d1 - this.firstGoodY;
@@ -1195,6 +1202,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -1194,6 +1201,12 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
} else {
speed = this.player.getAbilities().walkingSpeed * 10f;
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index c4f433832dc439830fc1584d36a197066fdb3e75..d32e6feca6c39a28f80574e4b080ddd4cbb60fdc 100644
index 4a8afc06f58bb608055a0fabc587bf06a7110232..db7f2715534ed71a2b285de095238586fe6a35b0 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2222,6 +2222,7 @@ public class ServerPlayer extends Player {
@@ -2252,6 +2252,7 @@ public class ServerPlayer extends Player {
this.setHealth(this.getMaxHealth());
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset

View File

@ -12,21 +12,12 @@ server threads
Allow usage of a single thread executor by not using ForkJoin so single core CPU's.
diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java
index 65e0ca442980f273d2fe5f131e174cd92f80da20..81f4f26a6b83079d36acd1fd86dede0eb1116c01 100644
index 3ed0bf0485266c0a2b459f5cc1940f85f74e3624..b9775bc4e601fe1be8e514222e56ae782a897395 100644
--- a/src/main/java/net/minecraft/Util.java
+++ b/src/main/java/net/minecraft/Util.java
@@ -56,7 +56,7 @@ import java.util.stream.Stream;
import javax.annotation.Nullable;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.Bootstrap;
-import net.minecraft.util.Mth;
+import net.minecraft.server.ServerWorkerThread;
import net.minecraft.util.datafix.DataFixers;
import net.minecraft.world.level.block.state.properties.Property;
import org.apache.commons.io.IOUtils;
@@ -65,8 +65,8 @@ import org.apache.logging.log4j.Logger;
public class Util {
@@ -68,8 +68,8 @@ public class Util {
private static final int DEFAULT_MAX_THREADS = 255;
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
private static final AtomicInteger WORKER_COUNT = new AtomicInteger(1);
- private static final ExecutorService BOOTSTRAP_EXECUTOR = makeExecutor("Bootstrap");
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
@ -35,12 +26,12 @@ index 65e0ca442980f273d2fe5f131e174cd92f80da20..81f4f26a6b83079d36acd1fd86dede0e
private static final ExecutorService IO_POOL = makeIoExecutor();
public static LongSupplier timeSource = System::nanoTime;
public static final UUID NIL_UUID = new UUID(0L, 0L);
@@ -101,14 +101,18 @@ public class Util {
@@ -105,14 +105,18 @@ public class Util {
return Instant.now().toEpochMilli();
}
- private static ExecutorService makeExecutor(String name) {
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7);
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads());
+ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority
+ // Paper start - use simpler thread pool that allows 1 thread
+ int i = Math.min(8, Math.max(Runtime.getRuntime().availableProcessors() - 2, 1));
@ -52,13 +43,13 @@ index 65e0ca442980f273d2fe5f131e174cd92f80da20..81f4f26a6b83079d36acd1fd86dede0e
} else {
- executorService = new ForkJoinPool(i, (forkJoinPool) -> {
- ForkJoinWorkerThread forkJoinWorkerThread = new ForkJoinWorkerThread(forkJoinPool) {
+ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), target -> new ServerWorkerThread(target, s, priorityModifier));
+ executorService = new java.util.concurrent.ThreadPoolExecutor(i, i,0L, TimeUnit.MILLISECONDS, new java.util.concurrent.LinkedBlockingQueue<Runnable>(), target -> new net.minecraft.server.ServerWorkerThread(target, s, priorityModifier));
+ }
+ /*
@Override
protected void onTermination(Throwable throwable) {
if (throwable != null) {
@@ -124,6 +128,7 @@ public class Util {
@@ -128,6 +132,7 @@ public class Util {
return forkJoinWorkerThread;
}, Util::onThreadException, true);
}
@ -67,10 +58,10 @@ index 65e0ca442980f273d2fe5f131e174cd92f80da20..81f4f26a6b83079d36acd1fd86dede0e
return executorService;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 00920e574ee1f104781d1f776d88ec9cd45eda93..a9f40f74cbd35533c6a334020c4f3ecd7ced3a43 100644
index a9f54a691af0cd15cbc38af8b8df3831de244aa7..19e7488055447d3bc402150c6686f96dfd592ac2 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -317,6 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -319,6 +319,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
S s0 = serverFactory.apply(thread); // CraftBukkit - decompile error
atomicreference.set(s0);

View File

@ -2,3 +2,4 @@ Add Timings to LevelTicks and EntityTickList
Check IBlockDataList#GLOBAL_PALETTE
Check if PlayerNaturallySpawnedEvent is called correctly
Make sure fluids aren't completly fucked, there may be more sync loads to nuke there as well
Improve Server Thread Pool and Thread Priorities: mojang added a max thread count property