more patches

This commit is contained in:
Jake Potrebic 2023-06-07 15:41:25 -07:00
parent 0b8147f68e
commit 44e22b45a5
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5
23 changed files with 132 additions and 132 deletions

View File

@ -10,7 +10,7 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b014f1bd167bad3e1dc613dce5c929f201ef27cc..421be41fc09d53b50c08e74f9c32a198e90a2c7c 100644
index 50a6f7f6ff5b24053d8f6eba06b0e1e5541be685..30134138a476716b9dfb82fe0f8b698e1a5ea3a6 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -244,6 +244,7 @@ public class ServerPlayer extends Player {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown
Bugs in the connection logic appears to leave stale connections even, preventing shutdown
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 338841804a92bea5ca074300eaea9374d1b77020..f22c50f0a2ef05e9f52550db7c40b5b99632650c 100644
index d05bed7b96c1d833041a31c00161ee377c088ee1..fd9a89b94c628cd2cdfd069bb5d99aeb5d75eb5c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -391,11 +391,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

View File

@ -5,38 +5,38 @@ Subject: [PATCH] Do not allow bees to load chunks for beehives
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 5049d72f080bb82ca0e1fc5e2348b3605a0204f1..2a6dda97fcc761eb3e7109e032d3bb10c83908d7 100644
index 8feb4192eac41a27e683ad391503a1480c7516de..2824792295dab6e52015b479a77c61efb1150041 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -409,6 +409,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -408,6 +408,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
if (this.hivePos == null) {
return false;
} else {
+ if (!this.level.isLoadedAndInBounds(hivePos)) return false; // Paper
BlockEntity tileentity = this.level.getBlockEntity(this.hivePos);
+ if (!this.level().isLoadedAndInBounds(this.hivePos)) return false; // Paper
BlockEntity tileentity = this.level().getBlockEntity(this.hivePos);
return tileentity instanceof BeehiveBlockEntity && ((BeehiveBlockEntity) tileentity).isFireNearby();
@@ -442,6 +443,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -441,6 +442,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
}
private boolean doesHiveHaveSpace(BlockPos pos) {
+ if (!this.level.isLoadedAndInBounds(pos)) return false; // Paper
BlockEntity tileentity = this.level.getBlockEntity(pos);
+ if (!this.level().isLoadedAndInBounds(pos)) return false; // Paper
BlockEntity tileentity = this.level().getBlockEntity(pos);
return tileentity instanceof BeehiveBlockEntity ? !((BeehiveBlockEntity) tileentity).isFull() : false;
@@ -919,6 +921,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -918,6 +920,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public boolean canBeeUse() {
if (Bee.this.hasHive() && Bee.this.wantsToEnterHive() && Bee.this.hivePos.closerToCenterThan(Bee.this.position(), 2.0D)) {
+ if (!Bee.this.level.isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper
BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos);
+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return false; // Paper
BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity) {
@@ -942,6 +945,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@@ -941,6 +944,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
@Override
public void start() {
+ if (!Bee.this.level.isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper
BlockEntity tileentity = Bee.this.level.getBlockEntity(Bee.this.hivePos);
+ if (!Bee.this.level().isLoadedAndInBounds(Bee.this.hivePos)) return; // Paper
BlockEntity tileentity = Bee.this.level().getBlockEntity(Bee.this.hivePos);
if (tileentity instanceof BeehiveBlockEntity) {

View File

@ -7,10 +7,10 @@ Suspected case would be around the technique used in .stopRiding
Stack will identify any causer of this and warn instead of crashing.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 1c39d12a6e72954a24ad51d8d6346341dc1c5d22..9c5925bc6a0fb277970d46c34dd812cc765a537a 100644
index 3ab66eb22561971392616c083bae5339e6ddc493..f27e9dd8185892b3948814937380140c45d7fd33 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1033,6 +1033,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1565,6 +1565,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
@ -25,10 +25,10 @@ index 1c39d12a6e72954a24ad51d8d6346341dc1c5d22..9c5925bc6a0fb277970d46c34dd812cc
EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 67e59ac94c584a742bf5e6e2094459234603ef06..4bf38f9006be9e838c54783dafd40cf84553d627 100644
index 203dc7444a2e6b0cfcaf0532e50ae0b22e51210e..a25d46fc3e2a106ab94c6b2b49558dd7be11c5b9 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2324,7 +2324,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2226,7 +2226,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -37,7 +37,7 @@ index 67e59ac94c584a742bf5e6e2094459234603ef06..4bf38f9006be9e838c54783dafd40cf8
if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -2358,6 +2358,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -2260,6 +2260,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.valid = true; // CraftBukkit

View File

@ -7,10 +7,10 @@ Causes sync chunk loads and who knows what all else.
This is safe because Spectators are skipped in unloaded chunks too in vanilla.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 421be41fc09d53b50c08e74f9c32a198e90a2c7c..e6945abd9337af07625793fb893718b00e67168a 100644
index 30134138a476716b9dfb82fe0f8b698e1a5ea3a6..b5ce9a93089ea64286bd33cf3fd6eab60863c66d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -683,7 +683,7 @@ public class ServerPlayer extends Player {
@@ -682,7 +682,7 @@ public class ServerPlayer extends Player {
public void doTick() {
try {

View File

@ -7,10 +7,10 @@ This fixes a lot of game state issues where packets were delayed for processing
due to 1.15's new queue but processed while dead.
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index a7e0203cc4bf7d98b65230fdbc4d873eeabdf9da..1ada0736ce35c0299e40d4ce8fbe49f170ea0c6f 100644
index 078986fb32eeecacc954ad6719e981ed8b3a2350..a8731cf957da9aad7ed6f5d372500bc34afd32ca 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1159,7 +1159,7 @@ public abstract class Player extends LivingEntity {
@@ -1160,7 +1160,7 @@ public abstract class Player extends LivingEntity {
@Override
protected boolean isImmobile() {

View File

@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading
massive amounts of surrounding chunks due to large AABB lookups.
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 4efa85f9c18927248dc2397df0bd3cd0a9063347..635d803066fa34a13174935ba0b63a0c86c0b1f4 100644
index eb020acbead65c189861898f5dc35978fef6aa9e..1bc82045fb5ca6bfce32cfeb3895e4de559153f5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -820,6 +820,7 @@ public abstract class PlayerList {
@@ -827,6 +827,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end
@ -26,7 +26,7 @@ index 4efa85f9c18927248dc2397df0bd3cd0a9063347..635d803066fa34a13174935ba0b63a0c
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 479586efacc17e418dd8d64d884efe67355e1844..33d37c7e1bd7e676d70ba942476def5c49a59176 100644
index a1eb5b0357d646b42031a5a21cc7740a94430558..ef5adc495a6feefdcf3ba595334436a5cb843a43 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -237,6 +237,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -38,11 +38,11 @@ index 479586efacc17e418dd8d64d884efe67355e1844..33d37c7e1bd7e676d70ba942476def5c
public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper
diff --git a/src/main/java/net/minecraft/world/level/BlockCollisions.java b/src/main/java/net/minecraft/world/level/BlockCollisions.java
index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..be578f14146b0184d5419d5b961c5d681f9ba7a3 100644
index f2c423154ed6a00882a46d93b69ed4f6ba73782c..90d8d484dd66d6da33f3dd55bdf1d3a059df2a84 100644
--- a/src/main/java/net/minecraft/world/level/BlockCollisions.java
+++ b/src/main/java/net/minecraft/world/level/BlockCollisions.java
@@ -66,22 +66,41 @@ public class BlockCollisions extends AbstractIterator<VoxelShape> {
protected VoxelShape computeNext() {
@@ -65,22 +65,41 @@ public class BlockCollisions<T> extends AbstractIterator<T> {
protected T computeNext() {
while(true) {
if (this.cursor.advance()) {
- int i = this.cursor.nextX();
@ -92,7 +92,7 @@ index 8390ce194ccc692139c0e870c16a7fb76ac8ba68..be578f14146b0184d5419d5b961c5d68
}
diff --git a/src/main/java/net/minecraft/world/level/CollisionGetter.java b/src/main/java/net/minecraft/world/level/CollisionGetter.java
index 4c373d6c8ddd9f5db88888cd8dbbfc24eb5df793..56d94c94fb0d4dc468bb5d69be655ddd5c6b5360 100644
index 30d037a8f890e06b27c5d3609bdd10e6b11cfb13..06107d69dff9f0b52a5f188095cbd9a9efa5684c 100644
--- a/src/main/java/net/minecraft/world/level/CollisionGetter.java
+++ b/src/main/java/net/minecraft/world/level/CollisionGetter.java
@@ -44,11 +44,13 @@ public interface CollisionGetter extends BlockGetter {

View File

@ -13,10 +13,10 @@ By skipping this, we avoid potential for a large spike on server start.
public net.minecraft.server.level.ServerPlayer fudgeSpawnLocation(Lnet/minecraft/server/level/ServerLevel;)V
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e6945abd9337af07625793fb893718b00e67168a..7dbf61d79db8a7f08e518c7858142bb0e0f469c4 100644
index b5ce9a93089ea64286bd33cf3fd6eab60863c66d..b8159a661be0e64a8b1af93c9a7f63d8835b7d03 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -336,7 +336,7 @@ public class ServerPlayer extends Player {
@@ -335,7 +335,7 @@ public class ServerPlayer extends Player {
this.stats = server.getPlayerList().getPlayerStats(this);
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
this.setMaxUpStep(1.0F);
@ -25,24 +25,24 @@ index e6945abd9337af07625793fb893718b00e67168a..7dbf61d79db8a7f08e518c7858142bb0
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -570,7 +570,7 @@ public class ServerPlayer extends Player {
@@ -569,7 +569,7 @@ public class ServerPlayer extends Player {
position = Vec3.atCenterOf(world.getSharedSpawnPos());
}
this.level = world;
this.setLevel(world);
- this.setPos(position);
+ this.setPosRaw(position.x(), position.y(), position.z()); // Paper - don't register to chunks yet
}
this.gameMode.setLevel((ServerLevel) world);
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 635d803066fa34a13174935ba0b63a0c86c0b1f4..3f5706d4b30b74ba54032ed48d37990ce6ddd715 100644
index 1bc82045fb5ca6bfce32cfeb3895e4de559153f5..33b0647843d392b3acd54fa0bb7835f1b65bb6ca 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -229,6 +229,7 @@ public abstract class PlayerList {
@@ -236,6 +236,7 @@ public abstract class PlayerList {
// Paper start
if (nbttagcompound == null) {
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
+ player.fudgeSpawnLocation(worldserver1); // only move to spawn on first login, otherwise, stay where you are....
}
// Paper end
player.setLevel(worldserver1);
player.setServerLevel(worldserver1);

View File

@ -71,7 +71,7 @@ index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f291
cause = cause.getCause();
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0b6685199 100644
index 3d71748684264a854f0e8648a99d6c8f09b0900e..d7428c963fc369e04926a5987653ea5bd325d51d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -299,7 +299,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@ -92,8 +92,8 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
+
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new io.papermc.paper.util.TickThread(() -> { // Paper - rewrite chunk system
@@ -888,6 +891,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
Thread thread = new Thread(() -> {
@@ -876,6 +879,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
private boolean hasStopped = false;
@ -101,7 +101,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
private final Object stopLock = new Object();
public final boolean hasStopped() {
synchronized (this.stopLock) {
@@ -902,6 +906,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -890,6 +894,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return;
this.hasStopped = true;
}
@ -121,13 +121,13 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
// CraftBukkit end
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -958,7 +975,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper
@@ -976,6 +993,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
// Spigot end
+ // Paper start - move final shutdown items here
+ LOGGER.info("Flushing Chunk IO");
io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
+ // io.papermc.paper.chunk.system.io.RegionFileIOThread.close(true); // Paper // Paper - rewrite chunk system
+ LOGGER.info("Closing Thread Pool");
+ Util.shutdownExecutors(); // Paper
+ LOGGER.info("Closing Server");
@ -140,7 +140,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
}
public String getLocalIp() {
@@ -1053,6 +1081,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1068,6 +1097,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() {
try {
@ -148,7 +148,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -1062,6 +1091,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1077,6 +1107,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.status = this.buildServerStatus();
// Spigot start
@ -167,7 +167,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -1122,6 +1163,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1131,6 +1173,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
} catch (Throwable throwable) {
@ -180,7 +180,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
MinecraftServer.LOGGER.error("Encountered an unexpected exception", throwable);
// Spigot Start
if ( throwable.getCause() != null )
@@ -1152,14 +1199,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1161,14 +1209,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.services.profileCache().clearExecutor();
}
@ -198,7 +198,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
}
}
@@ -1228,6 +1275,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1232,6 +1280,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Override
public TickTask wrapRunnable(Runnable runnable) {
@ -211,7 +211,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
return new TickTask(this.tickCount, runnable);
}
@@ -1463,6 +1516,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1467,6 +1521,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
try {
crashreport = CrashReport.forThrowable(throwable, "Exception ticking world");
} catch (Throwable t) {
@ -219,7 +219,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
throw new RuntimeException("Error generating crash report", t);
}
// Spigot End
@@ -1961,7 +2015,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1967,7 +2022,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess());
@ -237,7 +237,7 @@ index d00545c31de383470bcb8e4d9c6edad2f39c864c..ebc8446631a4c4abccd2292ec52b69a0
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index f22c50f0a2ef05e9f52550db7c40b5b99632650c..549ea8e0fe702615eefcbfd1cd6a30e05b7b3fd5 100644
index fd9a89b94c628cd2cdfd069bb5d99aeb5d75eb5c..eef9206a9d6a398eb1d44a36b6a1a342ed7bc878 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -269,7 +269,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -259,7 +259,7 @@ index f22c50f0a2ef05e9f52550db7c40b5b99632650c..549ea8e0fe702615eefcbfd1cd6a30e0
}
@Override
@@ -761,7 +762,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -736,7 +737,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@Override
public void stopServer() {
super.stopServer();
@ -269,10 +269,10 @@ index f22c50f0a2ef05e9f52550db7c40b5b99632650c..549ea8e0fe702615eefcbfd1cd6a30e0
}
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3f5706d4b30b74ba54032ed48d37990ce6ddd715..fd0b72abbbb237c640510aee65eafb9aa9fa0376 100644
index 33b0647843d392b3acd54fa0bb7835f1b65bb6ca..7102315de9acb3220f0f49bacb83386a8bcb0ce7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -540,7 +540,7 @@ public abstract class PlayerList {
@@ -547,7 +547,7 @@ public abstract class PlayerList {
this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
@ -294,22 +294,22 @@ index f5829ae484d93b547a5437b85a9621346384a11b..83701fbfaa56a232593ee8f11a3afb89
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 637092303bbce94fd37f193367264d51b855847d..31edf8f2c683f56e53040e735d015ca6d6966d01 100644
index f3eb0a541ba75ae3334e888130705d378c91e296..cde79f2001904852159cc4ed8a42e9b5aac74851 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -827,6 +827,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -812,6 +812,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
try {
tickConsumer.accept(entity);
} catch (Throwable throwable) {
+ if (throwable instanceof ThreadDeath) throw throwable; // Paper
// Paper start - Prevent tile entity and entity crashes
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level.getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 703830416a0483e960643bee269fe01e170112bd..ee1c9f2c8dd30b3f32a6d49aa1c43148f4e5ccac 100644
index 44bcb9c4d4b3449effc4f43659ecfe32be65cf98..cb8166771b57bb4dd7e64150bd02e8944307783f 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -1225,6 +1225,7 @@ public class LevelChunk extends ChunkAccess {
@@ -1091,6 +1091,7 @@ public class LevelChunk extends ChunkAccess {
gameprofilerfiller.pop();
} catch (Throwable throwable) {
@ -318,7 +318,7 @@ index 703830416a0483e960643bee269fe01e170112bd..ee1c9f2c8dd30b3f32a6d49aa1c43148
final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ());
net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable);
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 77911e26af9ec468c8a0c1fe8161b79c67b2303c..be1fbe64a5145b25c111ba3b6bb35109e77deb9d 100644
index 24607ed5f60ce68aeda7380c433a8b416ed885c4..203a25a2a8d843c33440d849a94b85e2c717d2a0 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -178,6 +178,36 @@ public class Main {
@ -471,18 +471,18 @@ index a142a56a920e153ed84c08cece993f10d76f7793..92d97a5810a379b427a99b4c63fb9844
String[] split = restartScript.split( " " );
if ( split.length > 0 && new File( split[0] ).isFile() )
diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java
index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..383c52c62f49b17db2fbf58009d6ea132d124bea 100644
index 06efdd7aa6d35a670e81c4f303618a7ba301396a..29b315188e3deb994b45b2154b2ce4f17c4fde2d 100644
--- a/src/main/java/org/spigotmc/WatchdogThread.java
+++ b/src/main/java/org/spigotmc/WatchdogThread.java
@@ -11,6 +11,7 @@ import org.bukkit.Bukkit;
public final class WatchdogThread extends io.papermc.paper.util.TickThread // Paper - rewrite chunk system
public class WatchdogThread extends Thread
{
+ public static final boolean DISABLE_WATCHDOG = Boolean.getBoolean("disable.watchdog"); // Paper
private static WatchdogThread instance;
private long timeoutTime;
private boolean restart;
@@ -39,6 +40,7 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -39,6 +40,7 @@ public class WatchdogThread extends Thread
{
if ( WatchdogThread.instance == null )
{
@ -490,7 +490,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..383c52c62f49b17db2fbf58009d6ea13
WatchdogThread.instance = new WatchdogThread( timeoutTime * 1000L, restart );
WatchdogThread.instance.start();
} else
@@ -70,12 +72,13 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -70,12 +72,13 @@ public class WatchdogThread extends Thread
// Paper start
Logger log = Bukkit.getServer().getLogger();
long currentTime = WatchdogThread.monotonicMillis();
@ -507,7 +507,7 @@ index b47d043144c499b1499f6b4be5a16a3f75c9fcb8..383c52c62f49b17db2fbf58009d6ea13
lastEarlyWarning = currentTime;
if (isLongTimeout) {
// Paper end
@@ -137,9 +140,25 @@ public final class WatchdogThread extends io.papermc.paper.util.TickThread // Pa
@@ -136,9 +139,25 @@ public class WatchdogThread extends Thread
if ( isLongTimeout )
{

View File

@ -7,7 +7,7 @@ Prevents pathfinding from spamming failures for things such as
arrow attacks.
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
index 46c2885097ab768bb9d62187fe0ad2d61007d353..7ffe5bef3778d5971ea4ceadf3102725fd0d08cd 100644
index 03cc97b13b1b8eb591b563c1eb52355b00ea3bf1..b376670d11088e524ce246f667e580e90cd119a3 100644
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
@@ -192,9 +192,29 @@ public abstract class PathNavigation {

View File

@ -5,29 +5,29 @@ Subject: [PATCH] Prevent opening inventories when frozen
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 7dbf61d79db8a7f08e518c7858142bb0e0f469c4..fedd9727e9d73fdbced6431b313a080705b1d9a5 100644
index b8159a661be0e64a8b1af93c9a7f63d8835b7d03..394a18d1f82eb3c313279ea5bad1d603ad1e3d02 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -652,7 +652,7 @@ public class ServerPlayer extends Player {
containerUpdateDelay = level.paperConfig().tickRates.containerUpdate;
@@ -651,7 +651,7 @@ public class ServerPlayer extends Player {
containerUpdateDelay = this.level().paperConfig().tickRates.containerUpdate;
}
// Paper end
- if (!this.level.isClientSide && !this.containerMenu.stillValid(this)) {
+ if (!this.level.isClientSide && this.containerMenu != this.inventoryMenu && (isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - auto close while frozen
- if (!this.level().isClientSide && !this.containerMenu.stillValid(this)) {
+ if (!this.level().isClientSide && this.containerMenu != this.inventoryMenu && (this.isImmobile() || !this.containerMenu.stillValid(this))) { // Paper - auto close while frozen
this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.containerMenu = this.inventoryMenu;
}
@@ -1501,7 +1501,7 @@ public class ServerPlayer extends Player {
@@ -1500,7 +1500,7 @@ public class ServerPlayer extends Player {
} else {
// CraftBukkit start
this.containerMenu = container;
- this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle()));
+ if (!isImmobile()) this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle())); // Paper
+ if (!this.isImmobile()) this.connection.send(new ClientboundOpenScreenPacket(container.containerId, container.getType(), container.getTitle())); // Paper
// CraftBukkit end
this.initMenu(container);
return OptionalInt.of(this.containerCounter);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 77314674a1f66a514f8f5a0fef5ca188b5af0b6a..14984e791bd9309672b1fb404b8552849854d393 100644
index 20aa0ad8e056ebb8d352c69da2a2ed044d338b41..ed6d7743ab6513ee4f4c09eae1c7124197df4ed1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -327,7 +327,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {

View File

@ -12,12 +12,12 @@ The entity's current team collision rule causes them to NEVER collide.
Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e6e4856db7d983460fdf898583915ff2e4a43d14..25e1dc97e3260e7f58b15a1759b8f9531c6a6f20 100644
index 574f8db51202c6686e7703f3193d63a1a4fefb65..6fbd1209edf59dab9cc8b0f568f2d31846264457 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3328,10 +3328,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.level.isClientSide()) {
this.level.getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
@@ -3377,10 +3377,24 @@ public abstract class LivingEntity extends Entity implements Attackable {
if (this.level().isClientSide()) {
this.level().getEntities(EntityTypeTest.forClass(net.minecraft.world.entity.player.Player.class), this.getBoundingBox(), EntitySelector.pushableBy(this)).forEach(this::doPush);
} else {
+ // Paper start - don't run getEntities if we're not going to use its result
+ if (!this.isPushable()) {
@ -28,15 +28,15 @@ index e6e4856db7d983460fdf898583915ff2e4a43d14..25e1dc97e3260e7f58b15a1759b8f953
+ return;
+ }
+
+ int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ if (i <= 0 && level.paperConfig().collisions.maxEntityCollisions <= 0) {
+ int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ if (i <= 0 && this.level().paperConfig().collisions.maxEntityCollisions <= 0) {
+ return;
+ }
+ // Paper end - don't run getEntities if we're not going to use its result
List<Entity> list = this.level.getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushableBy(this));
if (!list.isEmpty()) {
- int i = this.level.getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
- int i = this.level().getGameRules().getInt(GameRules.RULE_MAX_ENTITY_CRAMMING);
+ // Paper - moved up
int j;

View File

@ -87,10 +87,10 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index fedd9727e9d73fdbced6431b313a080705b1d9a5..75350988934c6eb1cd39587fa1f53335bf05db17 100644
index 394a18d1f82eb3c313279ea5bad1d603ad1e3d02..df41fdb2072f80129617f96a4f886724c6a0d744 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1904,9 +1904,24 @@ public class ServerPlayer extends Player {
@@ -1907,9 +1907,24 @@ public class ServerPlayer extends Player {
}
}
@ -116,10 +116,10 @@ index fedd9727e9d73fdbced6431b313a080705b1d9a5..75350988934c6eb1cd39587fa1f53335
if (getMainArm() != packet.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index fefe3dc1597d7449e0138be2f60918b06864108a..ef7078780b4829e61048233b60150b26f6a9b792 100644
index 1e2c102ca0d2012344451610e83372840d8d4a74..37e3095e4444097b9b6020d1d0aee27b870c3588 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -627,6 +627,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -552,6 +552,28 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
connection.disconnect(message == null ? net.kyori.adventure.text.Component.empty() : message);
}
}

View File

@ -7,10 +7,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from
I suspect it deals with teleporting as it uses players current x/y/z
diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java
index ffa1e457decf8502c3283352bf5be94d419ff165..d3c3db919e9b0507e8543313d9028394e5163673 100644
index f3c9a3dbb6f0e6f825b7477c89ed72ed52845419..2dbea6eef75ee90d62145ed855935bbc9996f15a 100644
--- a/src/main/java/net/minecraft/server/level/DistanceManager.java
+++ b/src/main/java/net/minecraft/server/level/DistanceManager.java
@@ -153,8 +153,8 @@ public abstract class DistanceManager {
@@ -285,8 +285,8 @@ public abstract class DistanceManager {
ObjectSet<ServerPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
if (objectset == null) return; // CraftBukkit - SPIGOT-6208
@ -20,4 +20,4 @@ index ffa1e457decf8502c3283352bf5be94d419ff165..d3c3db919e9b0507e8543313d9028394
+ if (objectset == null || objectset.isEmpty()) { // Paper
this.playersPerChunk.remove(i);
this.naturalSpawnChunkCounter.update(i, Integer.MAX_VALUE, false);
//this.playerTicketManager.update(i, Integer.MAX_VALUE, false); // Paper - no longer used
this.playerTicketManager.update(i, Integer.MAX_VALUE, false);

View File

@ -31,10 +31,10 @@ delays anymore.
public net.minecraft.server.level.ChunkMap addEntity(Lnet/minecraft/world/entity/Entity;)V
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 9c5925bc6a0fb277970d46c34dd812cc765a537a..f2bdb647f137a1334789dc56e517844b74d70bd9 100644
index f27e9dd8185892b3948814937380140c45d7fd33..3616f106b8bd5824700bfb67678599e6e1eca712 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1039,6 +1039,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1571,6 +1571,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
+ ": " + entity + (this.entityMap.containsKey(entity.getId()) ? " ALREADY CONTAINED (This would have crashed your server)" : ""), new Throwable());
return;
}
@ -43,7 +43,7 @@ index 9c5925bc6a0fb277970d46c34dd812cc765a537a..f2bdb647f137a1334789dc56e517844b
if (!(entity instanceof EnderDragonPart)) {
EntityType<?> entitytypes = entity.getType();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 75350988934c6eb1cd39587fa1f53335bf05db17..35091999392e7c5e6763aee490020c675e19134b 100644
index df41fdb2072f80129617f96a4f886724c6a0d744..4495edee3b29c441d14460be1bb3f5e0ef4b9851 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -267,6 +267,7 @@ public class ServerPlayer extends Player {
@ -55,10 +55,10 @@ index 75350988934c6eb1cd39587fa1f53335bf05db17..35091999392e7c5e6763aee490020c67
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a5f7f0dd3 100644
index 7102315de9acb3220f0f49bacb83386a8bcb0ce7..498516c98f396e601e67b9e47a62e89f709f98a5 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -304,6 +304,12 @@ public abstract class PlayerList {
@@ -311,6 +311,12 @@ public abstract class PlayerList {
this.playersByUUID.put(player.getUUID(), player);
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below
@ -71,7 +71,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a
// CraftBukkit start
CraftPlayer bukkitPlayer = player.getBukkitEntity();
@@ -342,6 +348,8 @@ public abstract class PlayerList {
@@ -349,6 +355,8 @@ public abstract class PlayerList {
player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
}
player.sentListPacket = true;
@ -80,7 +80,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a
// CraftBukkit end
player.getEntityData().refresh(player); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
@@ -367,6 +375,11 @@ public abstract class PlayerList {
@@ -374,6 +382,11 @@ public abstract class PlayerList {
playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect));
}
@ -92,7 +92,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start
@@ -415,6 +428,10 @@ public abstract class PlayerList {
@@ -422,6 +435,10 @@ public abstract class PlayerList {
}
}
@ -103,7 +103,7 @@ index fd0b72abbbb237c640510aee65eafb9aa9fa0376..0e2a84148e721a8f799f0746e379c16a
player.initInventoryMenu();
// CraftBukkit - Moved from above, added world
// Paper start - Add to collideRule team if needed
@@ -424,6 +441,7 @@ public abstract class PlayerList {
@@ -431,6 +448,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
}
// Paper end

View File

@ -7,10 +7,10 @@ The code following this has better support for null worlds to move
them back to the world spawn.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 33d37c7e1bd7e676d70ba942476def5c49a59176..ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd 100644
index ef5adc495a6feefdcf3ba595334436a5cb843a43..09e107b7d74e0043d5335be23885b86e24f8af29 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2200,9 +2200,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2267,9 +2267,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
bworld = server.getWorld(worldName);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 25e1dc97e3260e7f58b15a1759b8f9531c6a6f20..6541caa4a574271fa940d1dceef434655ffd8aa9 100644
index 6fbd1209edf59dab9cc8b0f568f2d31846264457..934c5246f43566a7277b77d0e74b38fc94c6836f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2126,7 +2126,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2169,7 +2169,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption);
if (damagesource.getEntity() instanceof net.minecraft.world.entity.player.Player) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads
Caused a deadlock
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
index 33ece83c6d41c65042356c44eee2c76934c07d0b..9576f581bb61e6c71de427c52dcc3e56dc3ed81e 100644
index 945d8b0f58f6a5b2281f136d3afbba3b34e0e6b5..8c6edd032c927f7d1e04e944b4ce5598d71cdd81 100644
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
@@ -101,6 +101,7 @@ public class FireBlock extends BaseFireBlock {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add phantom creative and insomniac controls
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
index 6fd874a83a248e6a7d427d18d11fc608544662c5..302676ef78ed5b3b7fc1b04851447ca72eed10c0 100644
index 668a7c3f36cdbe48e472cb810b27ae4ab39a65d6..9edea92834306b39abda36ba9be4e8796f113cc4 100644
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
+++ b/src/main/java/net/minecraft/world/entity/EntitySelector.java
@@ -27,6 +27,7 @@ public final class EntitySelector {
@ -17,7 +17,7 @@ index 6fd874a83a248e6a7d427d18d11fc608544662c5..302676ef78ed5b3b7fc1b04851447ca7
private EntitySelector() {}
// Paper start
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index a3663ea031f3a243f670bf1c98272a49daed71b0..0ada1ba6774e3d0514afb946fd0f104004cc020d 100644
index 9bd6e71ea38bf050832f0f7bbed4a5db6ddcef71..e5a53fd86fd34c88e2a5232085f649e6dd3173c2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -563,6 +563,7 @@ public class Phantom extends FlyingMob implements Enemy {
@ -29,15 +29,15 @@ index a3663ea031f3a243f670bf1c98272a49daed71b0..0ada1ba6774e3d0514afb946fd0f1040
return true;
}
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
index df7f23bb039a61ed26e117df934aad9ec5df3f58..66ac41d8fce4176feecf9a7e89e15244f47d261d 100644
index a18e6296d1f50c53291d41192a1009605a1b3583..8c767aba1e800c41412e92afe9cb09cfab1c6ffc 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -51,7 +51,7 @@ public class PhantomSpawner implements CustomSpawner {
@@ -49,7 +49,7 @@ public class PhantomSpawner implements CustomSpawner {
while (iterator.hasNext()) {
Player entityhuman = (Player) iterator.next();
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
- if (!entityhuman.isSpectator()) {
+ if (!entityhuman.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityhuman.isCreative())) { // Paper
BlockPos blockposition = entityhuman.blockPosition();
- if (!entityplayer.isSpectator()) {
+ if (!entityplayer.isSpectator() && (!world.paperConfig().entities.behavior.phantomsDoNotSpawnOnCreativePlayers || !entityplayer.isCreative())) { // Paper
BlockPos blockposition = entityplayer.blockPosition();
if (!world.dimensionType().hasSkyLight() || blockposition.getY() >= world.getSeaLevel() && world.canSeeSky(blockposition)) {

View File

@ -16,10 +16,10 @@ So even if something NEW comes up, it would be impossible to drop the
same item twice because the source was destroyed.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e22da633de 100644
index 09e107b7d74e0043d5335be23885b86e24f8af29..e17237a1fe56bf04516b0ee0489c781a225b6a81 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2330,11 +2330,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2397,11 +2397,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else {
// CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -28,29 +28,29 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2
return null;
}
// CraftBukkit end
- ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack);
+ ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + (double) yOffset, this.getZ(), stack.copy()); // Paper - clone so we can destroy original
- ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY() + (double) yOffset, this.getZ(), stack);
+ ItemEntity entityitem = new ItemEntity(this.level(), this.getX(), this.getY() + (double) yOffset, this.getZ(), stack.copy()); // Paper - copy so we can destroy original
+ stack.setCount(0); // Paper - destroy this item - if this ever leaks due to game bugs, ensure it doesn't dupe
entityitem.setDefaultPickUpDelay();
// CraftBukkit start
@@ -3115,6 +3116,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3186,6 +3187,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@Nullable
public Entity teleportTo(ServerLevel worldserver, PositionImpl location) {
// CraftBukkit end
+ // Paper start - fix bad state entities causing dupes
+ if (!isAlive() || !valid) {
+ if (!this.isAlive() || !this.valid) {
+ LOGGER.warn("Illegal Entity Teleport " + this + " to " + worldserver + ":" + location, new Throwable());
+ return null;
+ }
+ // Paper end
if (this.level instanceof ServerLevel && !this.isRemoved()) {
this.level.getProfiler().push("changeDimension");
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
this.level().getProfiler().push("changeDimension");
// CraftBukkit start
@@ -3141,6 +3148,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3212,6 +3219,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit end
this.level.getProfiler().popPush("reloading");
this.level().getProfiler().popPush("reloading");
+ // Paper start - Change lead drop timing to prevent dupe
+ if (this instanceof Mob) {
+ ((Mob) this).dropLeash(true, true); // Paper drop lead
@ -59,7 +59,7 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2
Entity entity = this.getType().create(worldserver);
if (entity != null) {
@@ -3154,10 +3166,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3225,10 +3237,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity();
@ -70,7 +70,7 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2
// CraftBukkit end
}
@@ -3278,7 +3286,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3349,7 +3357,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
public boolean canChangeDimensions() {
@ -80,10 +80,10 @@ index ecff22945c0a4cbc5cd26c04bb8e6416ba07fffd..04a388bd3a89a27f0b75134ef781b5e2
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b9283b73291 100644
index 934c5246f43566a7277b77d0e74b38fc94c6836f..d9ee22bbd654a2f39c443262b4a11f997ed1559e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1636,9 +1636,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1688,9 +1688,9 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Paper start
org.bukkit.event.entity.EntityDeathEvent deathEvent = this.dropAllDeathLoot(damageSource);
if (deathEvent == null || !deathEvent.isCancelled()) {
@ -96,7 +96,7 @@ index f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b92
// Paper start - clear equipment if event is not cancelled
if (this instanceof Mob) {
for (EquipmentSlot slot : this.clearedEquipmentSlots) {
@@ -1736,8 +1736,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1788,8 +1788,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.dropCustomDeathLoot(source, i, flag);
this.clearEquipmentSlots = prev; // Paper
}
@ -113,10 +113,10 @@ index f7ae0c52313f4d8c64849605148f8293e0e96141..65f5381c3362b16fa709728458f87b92
this.drops = new ArrayList<>();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7cce7075cd 100644
index 4413b609f1250cf9477fcb3fecd7b67afee0b896..101e3a1f0f52b67b55c99c2619cc43298d92a3f2 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -627,7 +627,7 @@ public class ArmorStand extends LivingEntity {
@@ -621,7 +621,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -125,7 +125,7 @@ index dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7c
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -635,7 +635,7 @@ public class ArmorStand extends LivingEntity {
@@ -629,7 +629,7 @@ public class ArmorStand extends LivingEntity {
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -135,7 +135,7 @@ index dbb4bfb3d1f1ce2e435ca531be36ea448c0e3212..3be5ea477cb3dd3ce75f3feced8daf7c
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cdf93e8751fa2520881290b2a7385f99ec4d0dc2..195f5ef5fcabcf021e429b2a51aa274e929c7322 100644
index 90cd8b87205a7b96eab8a9de5114d6c8ff339c8e..4a1699b56f2111881653404b38f18c9e2e7473b4 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -827,6 +827,11 @@ public class CraftEventFactory {