i really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really really love jmp

This commit is contained in:
Spottedleaf 2022-06-07 19:25:49 -07:00
parent a27b508dea
commit 26ea0402d8
30 changed files with 123 additions and 178 deletions

View File

@ -7,7 +7,7 @@ property lookups arent super cheap. they synchronize, validate
and check security managers.
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index 3a2e2adeefe73981b443216724270023408c1feb..615c4f9d9841f7ddc3e5c854e90f41c3905c2e8f 100644
index 39bd98b9496e4a27fd69a2de7c83c40689017ebc..831db5ee21938d71e99bf9d17b92a6ca15531740 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -25,6 +25,7 @@ import net.minecraft.world.phys.Vec2;

View File

@ -28,7 +28,7 @@ and then catch exceptions and close if they fire.
Part of this commit was authored by: Spottedleaf
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 3559f6c54e7674d3eaf023d2ceaee13edfcae5b2..a0d3d9e344f530b713167d0663634c40eefce5b5 100644
index 58e50b56b0e3f1388826c73c4616a1e24852bdbd..6a77a2148efb95d86710b80e4d109f508e3dd125 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -97,6 +97,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -265,7 +265,7 @@ index 3559f6c54e7674d3eaf023d2ceaee13edfcae5b2..a0d3d9e344f530b713167d0663634c40
if (this.getDisconnectedReason() != null) {
@@ -429,7 +561,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
} else if (this.getPacketListener() != null) {
this.getPacketListener().onDisconnect(new TranslatableComponent("multiplayer.disconnect.generic"));
this.getPacketListener().onDisconnect(Component.translatable("multiplayer.disconnect.generic"));
}
- this.queue.clear(); // Free up packet queue.
+ clearPacketQueue(); // Paper
@ -297,10 +297,10 @@ index 74bfe0d3942259c45702b099efdc4e101a4e3022..e8fcd56906d26f6dc87959e32c4c7c78
return false;
}
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index e174d9803e557470068f7893260d55a042888517..7c820a8f9ae85eb6941dce0e6296775fb331d720 100644
index 5e1a6f2cd2d0d9c6b17c446fa782e4089cc138d5..78808e6239070121d36b6c377202d76e8fb3fa32 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -63,10 +63,12 @@ public class ServerConnectionListener {
@@ -64,10 +64,12 @@ public class ServerConnectionListener {
final List<Connection> connections = Collections.synchronizedList(Lists.newArrayList());
// Paper start - prevent blocking on adding a new network manager while the server is ticking
private final java.util.Queue<Connection> pending = new java.util.concurrent.ConcurrentLinkedQueue<>();
@ -313,7 +313,7 @@ index e174d9803e557470068f7893260d55a042888517..7c820a8f9ae85eb6941dce0e6296775f
}
}
// Paper end
@@ -101,6 +103,7 @@ public class ServerConnectionListener {
@@ -102,6 +104,7 @@ public class ServerConnectionListener {
;
}

View File

@ -9,7 +9,7 @@ creating too large of a packet to sed.
Co authored by Spottedleaf
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
index b89965c73bb6f40e688bd29daf6630ccce054100..d004997cb94648a24135f0478be3a25393b67925 100644
index a7e49476b3e0e46f97cb2cb57377f7ffe5146501..7cf356a700e47686e093e2f2f880af919dc0414a 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
@@ -24,6 +24,14 @@ public class ClientboundLevelChunkPacketData {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process
Fixes GH-1887
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 273f5eb930a37046900f706f5f710ae3fcc9b6df..0760fcc3bde6b819ae526e2c66486b09a948d98b 100644
index aa78c218d0709eff043fb7e7f5e9a3f8fa918982..374fccfec47769d2df51056fb6d1948f472a6802 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -222,6 +222,7 @@ public class Zombie extends Monster {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 9e3272a85e760e65217bd75c3ba9bfe21979fd35..cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb 100644
index 8ff7ae4af69cd62419b6c51c7a7d957a6550c7b9..056d89f0a8f94e2be94a773068cf2cf52556ce5a 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1123,6 +1123,7 @@ public abstract class PlayerList {
@@ -1127,6 +1127,7 @@ public abstract class PlayerList {
}
public void setUsingWhiteList(boolean whitelistEnabled) {

View File

@ -10,10 +10,10 @@ persistenting Living Entity, SPAWNER for spawners,
or DEFAULT since data was not stored.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b57b6f411442827ec1222fbf5bf87947e325d470..19dc74ab02744c70a3b2c75c0a62edb1cfca1be3 100644
index a37991c960df688f4890fd1a9d88b2e637f26101..1a5ebca952422de8caded739e1816deb4b1a4d72 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1191,6 +1191,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1209,6 +1209,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
return true;
}
// Paper end
@ -22,10 +22,10 @@ index b57b6f411442827ec1222fbf5bf87947e325d470..19dc74ab02744c70a3b2c75c0a62edb1
// Paper start
if (DEBUG_ENTITIES) {
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb..1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1 100644
index 056d89f0a8f94e2be94a773068cf2cf52556ce5a..604ce3bcec48f63292020220e463659554ada7e0 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -342,7 +342,7 @@ public abstract class PlayerList {
@@ -346,7 +346,7 @@ public abstract class PlayerList {
// CraftBukkit start
ServerLevel finalWorldServer = worldserver1;
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
@ -35,10 +35,10 @@ index cc8d7d56bf30732482ac2a16bdfb22d2c1b18deb..1de3cb1ed15c9efbc602a46a28bbb347
});
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102dbad2d304 100644
index 18fe107cee949495d2eb7525526d96390c04b0d6..6f426a028e9158bf6ff554d9b9e1f0d097505ecf 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -70,6 +70,8 @@ import net.minecraft.world.InteractionHand;
@@ -73,6 +73,8 @@ import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.Nameable;
import net.minecraft.world.damagesource.DamageSource;
@ -47,15 +47,15 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.vehicle.Boat;
@@ -168,6 +170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
@@ -190,6 +192,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
};
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason;
}
// Paper end
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
@@ -1874,6 +1877,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
private CraftEntity bukkitEntity;
@@ -1922,6 +1925,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
}
@ -65,7 +65,7 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d
// Save entity's from mob spawner status
if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true);
@@ -2017,6 +2023,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2065,6 +2071,26 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
}
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
@ -93,10 +93,10 @@ index 44c53588c54fd275d3f0c7bb5febb67838c939ce..30b79e3dfbc50fee70d52367092c102d
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index 1c76a59eb25148bf2523e9d68cc165b6cd3e1d23..fafbc8601ba3378b86c660f947e23ec293dd7e7e 100644
index 3e8848cbf22902b1a0e015ecf9e330c9235bc638..01269e52855f88f5cfd7b57b2dc12f5d3e3c1583 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -179,6 +179,7 @@ public abstract class BaseSpawner {
@@ -181,6 +181,7 @@ public abstract class BaseSpawner {
// Spigot End
}
entity.spawnedViaMobSpawner = true; // Paper
@ -105,10 +105,10 @@ index 1c76a59eb25148bf2523e9d68cc165b6cd3e1d23..fafbc8601ba3378b86c660f947e23ec2
// Spigot Start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 8e6ae581c714c1fec6b1cdc1c26b83772573ab27..b732d9de71e5799969852a22f22e860637f7d64e 100644
index c752f70b0c05cb7acd8c7cfce92ab05af560671a..5f232c45d6e01943cf1ca1d7802d4915887a6b32 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1238,5 +1238,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1249,5 +1249,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public boolean fromMobSpawner() {
return getHandle().spawnedViaMobSpawner;
}

View File

@ -5,11 +5,11 @@ Subject: [PATCH] Update entity Metadata for all tracked players
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b4c8abce7 100644
index 232341fa41b1962d329cc17f3146e41c51d22164..2c43304fd7a189f399f0e7757dbd593f3f462c37 100644
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
@@ -391,6 +391,12 @@ public class ServerEntity {
return ClientboundMoveEntityPacket.packetToEntity(this.xp, this.yp, this.zp);
@@ -371,6 +371,12 @@ public class ServerEntity {
}
+ // Paper start - Add broadcast method
@ -22,10 +22,10 @@ index 861f3790179e18f6192ac8b2fb5d2ecbc54484ad..5e3f489964489e0facc93a823a1cb84b
this.broadcast.accept(packet);
if (this.entity instanceof ServerPlayer) {
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9933821711eab76bb08be74252639dc3093dfb88..4788c98dc93547f3308cb565eee9cfc4947f91eb 100644
index ea764d2b935c42f88e8dcaff6ba85e5122dbbcc6..a2947ec5dd0df55e1edc9e2f016a4b618b8c5349 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -2309,7 +2309,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -2500,7 +2500,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
if (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem) {
// Refresh the current entity metadata

View File

@ -26,7 +26,7 @@ index 51cb2644aa516a59e19fecb308d519dbc7e5fb11..e548aa0ca4e1e94ab628614b44fc1156
this.dataOutputStream.write(value);
}
diff --git a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
index 3ea85dc12a580001c193c4d1fb719234030e1615..61e4fe91ac8648edafd39a952939c667c2838207 100644
index cf3071d0b1f818995583e58d64194e4ceb927959..29e2bc3fa3091df3c2fa908a2632c3b592c4a872 100644
--- a/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
+++ b/src/main/java/net/minecraft/server/rcon/thread/QueryThreadGs4.java
@@ -105,13 +105,32 @@ public class QueryThreadGs4 extends GenericThread {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerPostRespawnEvent
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce2046b052 100644
index 604ce3bcec48f63292020220e463659554ada7e0..6ef66a4c040ad9ad33d363f212c70621b260b6c7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -722,9 +722,14 @@ public abstract class PlayerList {
@@ -726,9 +726,14 @@ public abstract class PlayerList {
boolean flag2 = false;
@ -24,7 +24,7 @@ index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
if (worldserver1 != null) {
Optional optional;
@@ -776,6 +781,7 @@ public abstract class PlayerList {
@@ -780,6 +785,7 @@ public abstract class PlayerList {
location = respawnEvent.getRespawnLocation();
if (!flag) entityplayer.reset(); // SPIGOT-4785
@ -32,7 +32,7 @@ index 1de3cb1ed15c9efbc602a46a28bbb3473d6c91e1..fbed83f8c49267a657a3df1c6e4b42ce
} else {
location.setWorld(worldserver.getWorld());
}
@@ -833,6 +839,13 @@ public abstract class PlayerList {
@@ -837,6 +843,13 @@ public abstract class PlayerList {
if (entityplayer.connection.isDisconnected()) {
this.save(entityplayer);
}

View File

@ -6,10 +6,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items
vanilla checks for == 0
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index df5064e69f10bb366572e5f1da197514f3067faf..ff3182c40d2e3942190cac8ddb008ba6c5a72d99 100644
index ab48f572c778924354f30ff05bb45f3b235817af..75575f73ab0f4b7fad92843a1d11bae059b50366 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -106,6 +106,7 @@ public class ItemEntity extends Entity {
@@ -116,6 +116,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;
@ -17,7 +17,7 @@ index df5064e69f10bb366572e5f1da197514f3067faf..ff3182c40d2e3942190cac8ddb008ba6
if (this.age != -32768) this.age += elapsedTicks;
this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end
@@ -192,6 +193,7 @@ public class ItemEntity extends Entity {
@@ -202,6 +203,7 @@ public class ItemEntity extends Entity {
// CraftBukkit start - Use wall time for pickup and despawn timers
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks;

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events
Fires event at start and end of a server tick
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 067fa77d706a193dd3dcb4cc58d2e1b25840e6f3..dbf70401a93776f422af4386bceaae6fb9883c4f 100644
index 5407fea80a66c43550b0b557174d710676b5f118..95034c3486ccd7179c4b41c270a252b26ce77a9c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1348,6 +1348,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1306,6 +1306,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
});
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
// Paper end
@ -17,7 +17,7 @@ index 067fa77d706a193dd3dcb4cc58d2e1b25840e6f3..dbf70401a93776f422af4386bceaae6f
++this.tickCount;
this.tickChildren(shouldKeepTicking);
@@ -1386,6 +1387,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1344,6 +1345,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.runAllTasks();
}
// Paper end

View File

@ -8,10 +8,10 @@ Exposes a mutable array on items a player should keep on death
Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index b26c4933d4b8e782e9cf5de3371162d30b304954..572f7092a416793e726c794b7de34def47196e1e 100644
index 67b4e7c887e012f32ea2a269717373568efed212..321b6a74fadd0aa8b5b956743bde289e69b65578 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -766,6 +766,46 @@ public class ServerPlayer extends Player {
@@ -773,6 +773,46 @@ public class ServerPlayer extends Player {
});
}
@ -56,9 +56,9 @@ index b26c4933d4b8e782e9cf5de3371162d30b304954..572f7092a416793e726c794b7de34def
+ // Paper end
+
@Override
public void die(DamageSource source) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@@ -851,7 +891,12 @@ public class ServerPlayer extends Player {
public void die(DamageSource damageSource) {
this.gameEvent(GameEvent.ENTITY_DIE);
@@ -859,7 +899,12 @@ public class ServerPlayer extends Player {
this.dropExperience();
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {

View File

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index a00b4c84cc27678c07d0195a90f38dc458a11862..dab1b7491fff4da9f606d041536adb649bfccd9a 100644
index 3b2357eb2844d9e8cf00a43884759da60b9327eb..6d5d67aec4be3205032ce3b97e12356b89a0f5fe 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -874,9 +874,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -835,9 +835,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Nullable
public BlockEntity getBlockEntity(BlockPos blockposition, boolean validate) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 6871ee1f69b2dced4874c0d28b27b6ba11ef1c9f..7540be1005db97a20d44d55c0e59547113d6ad80 100644
index 4a98dc57a5d3f3e1e55ba366f38062514e85ed34..486e9e1d416021561d769d1f69b22d0a1e354342 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -216,6 +216,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -217,6 +217,29 @@ public class CraftWorld extends CraftRegionAccessor implements World {
return this.getHighestBlockYAt(x, z, org.bukkit.HeightMap.MOTION_BLOCKING);
}

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Mob Spawner API Enhancements
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
index fafbc8601ba3378b86c660f947e23ec293dd7e7e..70e1f9bd9e4711aaf45ff8b7214726de646997ab 100644
index 01269e52855f88f5cfd7b57b2dc12f5d3e3c1583..cf956ad7a327b2bd16c1c68837888f6049d606df 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -230,7 +230,13 @@ public abstract class BaseSpawner {
@@ -235,7 +235,13 @@ public abstract class BaseSpawner {
}
public void load(@Nullable Level world, BlockPos pos, CompoundTag nbt) {
@ -22,7 +22,7 @@ index fafbc8601ba3378b86c660f947e23ec293dd7e7e..70e1f9bd9e4711aaf45ff8b7214726de
boolean flag = nbt.contains("SpawnPotentials", 9);
boolean flag1 = nbt.contains("SpawnData", 10);
@@ -266,9 +272,15 @@ public abstract class BaseSpawner {
@@ -271,9 +277,15 @@ public abstract class BaseSpawner {
}
}
@ -40,7 +40,7 @@ index fafbc8601ba3378b86c660f947e23ec293dd7e7e..70e1f9bd9e4711aaf45ff8b7214726de
this.spawnCount = nbt.getShort("SpawnCount");
}
@@ -285,9 +297,20 @@ public abstract class BaseSpawner {
@@ -290,9 +302,20 @@ public abstract class BaseSpawner {
}
public CompoundTag save(CompoundTag nbt) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4788c98dc93547f3308cb565eee9cfc4947f91eb..c205534209dc1de3b0ff49762361a23d55434742 100644
index a2947ec5dd0df55e1edc9e2f016a4b618b8c5349..c7d85b95c57cd049f5a0c0fbaf06df8183c40684 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -439,7 +439,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
@@ -466,7 +466,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait

View File

@ -6,12 +6,12 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450)
This also fixes the adding sound playing when the item frame direction is changed.
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
index f2339fc092a5ef12da701de820ff3c315bd0a4b0..d02f507ac58bae5d4f669dae52cc01c35651cee5 100644
index 11638d21d509518809b4d992165913ffec315328..ac0fe310b01506b3b2a767d47f65cefb57f58c7d 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java
@@ -307,7 +307,7 @@ public class ItemFrame extends HangingEntity {
}
@@ -327,7 +327,7 @@ public class ItemFrame extends HangingEntity {
this.onItemChanged(itemstack);
this.getEntityData().set(ItemFrame.DATA_ITEM, itemstack);
- if (!itemstack.isEmpty() && playSound) { // CraftBukkit
+ if (!itemstack.isEmpty() && flag && playSound) { // CraftBukkit // Paper - only play sound when update flag is set

View File

@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled
synchronously when the server gets shut down.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index dbf70401a93776f422af4386bceaae6fb9883c4f..99b4f6ad3a973e400e37d53b977e19573bdfd694 100644
index 95034c3486ccd7179c4b41c270a252b26ce77a9c..1c2fd04a554dafa8988bacdaed19edb1a653ca38 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2333,7 +2333,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2299,7 +2299,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
@Override
public boolean isSameThread() {
@ -29,10 +29,10 @@ index dbf70401a93776f422af4386bceaae6fb9883c4f..99b4f6ad3a973e400e37d53b977e1957
public boolean isDebugging() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index cf00b51faaefd6607ab11003276a48f394b25f71..17ad98a31c1eacb701c67c39b6c84e9de4e06893 100644
index 35a652b6a2c569787ecb32029de05ef1c6c9de6f..db3e7d6d21cc2780221d5f9a82cfd8010bbdad99 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2067,7 +2067,7 @@ public final class CraftServer implements Server {
@@ -2050,7 +2050,7 @@ public final class CraftServer implements Server {
@Override
public boolean isPrimaryThread() {

View File

@ -23,10 +23,10 @@ index 0078fb8df378058a6ddeb5dbea4132c8c9c3fa64..321dedb7bea65c85aaeac338b88e85c6
return this.getBoolean(path, def, true);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 99b4f6ad3a973e400e37d53b977e19573bdfd694..30c10b151503a1710d3adce81640bfbd727eabe0 100644
index 1c2fd04a554dafa8988bacdaed19edb1a653ca38..03a8b247aa1045a70e559e4cda8350a2b7bc5ed4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -758,31 +758,34 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -726,31 +726,34 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start
public void prepareLevels(ChunkProgressListener worldloadlistener, ServerLevel worldserver) {
@ -71,7 +71,7 @@ index 99b4f6ad3a973e400e37d53b977e19573bdfd694..30c10b151503a1710d3adce81640bfbd
if (true) {
ServerLevel worldserver1 = worldserver;
@@ -805,7 +808,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -773,7 +776,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// this.nextTickTime = SystemUtils.getMillis() + 10L;
this.executeModerately();
// CraftBukkit end
@ -81,7 +81,7 @@ index 99b4f6ad3a973e400e37d53b977e19573bdfd694..30c10b151503a1710d3adce81640bfbd
// CraftBukkit start
// this.updateMobSpawningFlags();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 19dc74ab02744c70a3b2c75c0a62edb1cfca1be3..13966539626742b6914b940c6dd74c83485e588e 100644
index 1a5ebca952422de8caded739e1816deb4b1a4d72..97f1679c2a549b27fd70b6773819feae26fc54bb 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -63,6 +63,7 @@ import net.minecraft.network.protocol.game.ClientboundSoundEntityPacket;
@ -92,7 +92,7 @@ index 19dc74ab02744c70a3b2c75c0a62edb1cfca1be3..13966539626742b6914b940c6dd74c83
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.ServerScoreboard;
import net.minecraft.server.level.progress.ChunkProgressListener;
@@ -1618,12 +1619,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1710,12 +1711,84 @@ public class ServerLevel extends Level implements WorldGenLevel {
return ((MapIndex) this.getServer().overworld().getDataStorage().computeIfAbsent(MapIndex::load, MapIndex::new, "idcounts")).getFreeAuxValueForMap();
}
@ -192,7 +192,7 @@ index 1b565b2809c2d367e21971c5154f35c9763995e6..b0f899835ded29aff108d1674bf4a1a6
+ void setChunkRadius(int radius); // Paper - allow changing chunk radius
}
diff --git a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
index 1fdb4242784e55d5bb6102deb150a57a156aacd3..419e1c4db73631de3d65d8a0e7d5eb080b2e3935 100644
index 4d2348df25410a0b5364eec066880326d6667dad..286aad3205ef8a9e21a47ef07893844fe857556a 100644
--- a/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
+++ b/src/main/java/net/minecraft/server/level/progress/LoggerChunkProgressListener.java
@@ -11,12 +11,19 @@ import org.slf4j.Logger;
@ -217,10 +217,10 @@ index 1fdb4242784e55d5bb6102deb150a57a156aacd3..419e1c4db73631de3d65d8a0e7d5eb08
this.maxCount = i * i;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index c7e919516254eabd21dc460be4569c44d1fe1176..f782147a7523b952b272ba67c7b85164236379ef 100644
index 486e9e1d416021561d769d1f69b22d0a1e354342..1ca7903bd14d85e8ee95389250fa3228406c2ca9 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1350,15 +1350,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -1351,15 +1351,21 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public void setKeepSpawnInMemory(boolean keepLoaded) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] ChunkMapDistance CME
diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java
index 41fe4c01c2876dcb2372c4b412c8927359cf74d7..8356a0e816324ce67df14151bdc186e60d8a223c 100644
index 90fcb4dc89643b1c706ea4554595a842198558a1..6e7d09cd48048957a14835b857ac708aafe8f664 100644
--- a/src/main/java/net/minecraft/server/level/ChunkHolder.java
+++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java
@@ -73,6 +73,7 @@ public class ChunkHolder {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 17ad98a31c1eacb701c67c39b6c84e9de4e06893..43038b4772975c1fb171c30382ae0a6c43d13676 100644
index db3e7d6d21cc2780221d5f9a82cfd8010bbdad99..ab13a26a1391ad7403dca09a366fc11163849632 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2642,5 +2642,10 @@ public final class CraftServer implements Server {
@@ -2625,5 +2625,10 @@ public final class CraftServer implements Server {
profile.getProperties().putAll(((CraftPlayer)player).getHandle().getGameProfile().getProperties());
return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
}

View File

@ -8,27 +8,40 @@ This patch also adds a chunk status cache on region files (note that
its only purpose is to cache the status on DISK)
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a841a74784 100644
index 9b0ad38bacf9bb3e15106f5822389e7bc550411b..ef7ef7fa4116e0def1d73e604ee706deb4c94330 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -90,6 +90,7 @@ import net.minecraft.world.level.chunk.ProtoChunk;
import net.minecraft.world.level.chunk.UpgradeData;
import net.minecraft.world.level.chunk.storage.ChunkSerializer;
import net.minecraft.world.level.chunk.storage.ChunkStorage;
+import net.minecraft.world.level.chunk.storage.RegionFile;
import net.minecraft.world.level.entity.ChunkStatusUpdateListener;
import net.minecraft.world.level.levelgen.blending.BlendingData;
import net.minecraft.world.level.levelgen.structure.StructureStart;
@@ -1218,10 +1219,59 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@Nullable
public CompoundTag readChunk(ChunkPos pos) throws IOException {
CompoundTag nbttagcompound = this.read(pos);
@@ -1243,9 +1243,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end
private CompletableFuture<Optional<CompoundTag>> readChunk(ChunkPos chunkPos) {
- return this.read(chunkPos).thenApplyAsync((optional) -> {
- return optional.map((nbttagcompound) -> this.upgradeChunkTag(nbttagcompound, chunkPos)); // CraftBukkit
- }, Util.backgroundExecutor());
+ // Paper start - Cache chunk status on disk
+ try {
+ return CompletableFuture.completedFuture(Optional.ofNullable(this.readConvertChunkSync(chunkPos)));
+ } catch (Throwable thr) {
+ return CompletableFuture.failedFuture(thr);
+ }
+ // Paper end - Cache chunk status on disk
}
// CraftBukkit start
@@ -1254,6 +1258,63 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// CraftBukkit end
}
+ // Paper start - Cache chunk status on disk
+ @Nullable
+ public CompoundTag readConvertChunkSync(ChunkPos pos) throws IOException {
+ CompoundTag nbttagcompound = this.readSync(pos);
+ // Paper start - Cache chunk status on disk
+ if (nbttagcompound == null) {
+ return null;
+ }
+
+ nbttagcompound = this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit
+ nbttagcompound = this.upgradeChunkTag(nbttagcompound, pos); // CraftBukkit
+ if (nbttagcompound == null) {
+ return null;
+ }
@ -41,14 +54,13 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8
+
+ // Paper start - chunk status cache "api"
+ public ChunkStatus getChunkStatusOnDiskIfCached(ChunkPos chunkPos) {
+ RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos);
- return nbttagcompound == null ? null : this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), pos, level); // CraftBukkit
+ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFileIfLoaded(chunkPos);
+
+ return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z);
}
+ }
+
+ public ChunkStatus getChunkStatusOnDisk(ChunkPos chunkPos) throws IOException {
+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true);
+ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, true);
+
+ if (regionFile == null || !regionFileCache.chunkExists(chunkPos)) {
+ return null;
@ -66,7 +78,7 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8
+ }
+
+ public void updateChunkStatusOnDisk(ChunkPos chunkPos, @Nullable CompoundTag compound) throws IOException {
+ RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false);
+ net.minecraft.world.level.chunk.storage.RegionFile regionFile = regionFileCache.getRegionFile(chunkPos, false);
+
+ regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkSerializer.getStatus(compound));
+ }
@ -81,10 +93,10 @@ index 04b287c91acef5b9f0b73edb71fbefbb1f08eee6..ebb2b7323b4e11749b7b905cc76863a8
// Spigot start
return this.anyPlayerCloseEnoughForSpawning(pos, false);
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
index a7f173c385f7a96010652b92fe14bffa5f1ffc68..954e141e5617d6d52e2f3008c25fe9e2fe2f0f9a 100644
index 441d46635caedfae3cb2f46d30b8d9ae95636e7b..e6240f891e396d91e31b02fdf3084be77e9d6697 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
@@ -290,6 +290,17 @@ public class ChunkStatus {
@@ -292,6 +292,17 @@ public class ChunkStatus {
return this.chunkType;
}
@ -103,10 +115,10 @@ index a7f173c385f7a96010652b92fe14bffa5f1ffc68..954e141e5617d6d52e2f3008c25fe9e2
return (ChunkStatus) Registry.CHUNK_STATUS.get(ResourceLocation.tryParse(id));
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index 37a60420b993525852492fd6665fb75afee9796f..9a4fe42da43037a65738b978c0c6c9969de59e76 100644
index 8cc2a2c026eb44461cd94faeb64fb2151d2d3898..8480310bd389ad55b8138a20da59cbcffb973819 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -606,6 +606,17 @@ public class ChunkSerializer {
@@ -623,6 +623,17 @@ public class ChunkSerializer {
}));
}
@ -188,24 +200,16 @@ index a1bfcdd713c47d8613eb4af7625a64d51161690b..4bc33c31d497aa7d69226ab870fd7890
} catch (Throwable throwable) {
if (dataoutputstream != null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index f782147a7523b952b272ba67c7b85164236379ef..0edb08a391f806e56ed1bd4812eb9c9d2b966bd7 100644
index 1ca7903bd14d85e8ee95389250fa3228406c2ca9..2fd677796c6393d6997dca455a7daeef191e51b7 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -20,6 +20,7 @@ import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
+import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import net.minecraft.core.BlockPos;
@@ -293,8 +294,22 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -294,9 +294,23 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean isChunkGenerated(int x, int z) {
+ // Paper start - Fix this method
+ if (!Bukkit.isPrimaryThread()) {
+ return CompletableFuture.supplyAsync(() -> {
+ return java.util.concurrent.CompletableFuture.supplyAsync(() -> {
+ return CraftWorld.this.isChunkGenerated(x, z);
+ }, world.getChunkSource().mainThreadProcessor).join();
+ }
@ -217,13 +221,15 @@ index f782147a7523b952b272ba67c7b85164236379ef..0edb08a391f806e56ed1bd4812eb9c9d
+ return chunk instanceof ImposterProtoChunk || chunk instanceof net.minecraft.world.level.chunk.LevelChunk;
+ }
try {
- return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed)
- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)).get().isPresent();
- } catch (InterruptedException | ExecutionException ex) {
+ return world.getChunkSource().chunkMap.getChunkStatusOnDisk(new ChunkPos(x, z)) == ChunkStatus.FULL;
+ // Paper end
} catch (IOException ex) {
+ } catch (IOException ex) {
throw new RuntimeException(ex);
}
@@ -406,20 +421,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
@@ -407,20 +421,48 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean loadChunk(int x, int z, boolean generate) {
org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot

View File

@ -37,10 +37,10 @@ index 321dedb7bea65c85aaeac338b88e85c6d453325d..98f81bc3277096493ff0a942361bf795
}
+
diff --git a/src/main/java/net/minecraft/world/level/NaturalSpawner.java b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
index 1603657d75334c0425e737cd661a4ed724333206..6282d5899fe0b78ecbb6236db178c8231f7cd521 100644
index 31b330e140d71d9b017e68eab531a59d4f2ed9a2..fedc36ceebaf3e1d267431bdf7db81e25f4d6fd7 100644
--- a/src/main/java/net/minecraft/world/level/NaturalSpawner.java
+++ b/src/main/java/net/minecraft/world/level/NaturalSpawner.java
@@ -86,6 +86,13 @@ public final class NaturalSpawner {
@@ -87,6 +87,13 @@ public final class NaturalSpawner {
MobCategory enumcreaturetype = entity.getType().getCategory();
if (enumcreaturetype != MobCategory.MISC) {

View File

@ -40,7 +40,7 @@ index 98f81bc3277096493ff0a942361bf79525000431..b230c79a830375a1d3b9262620f51039
}
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 7837fb0419c94731eba618e903353ddc047bbed6..ccaa97956e40c6a79371d813719f65687991ec5b 100644
index 80fdb953d7a49b05108672e18ea326182fa7cfd6..fcbc5a3aee2e23a0b30b1f774d608f85b85f7d71 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
@@ -161,7 +161,7 @@ public abstract class Projectile extends Entity {

View File

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kashike <kashike@vq.lc>
Date: Wed, 20 Mar 2019 21:19:29 -0700
Subject: [PATCH] Use proper max length when serialising BungeeCord text
component
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
index 8b0d452b12d5eca1f92e2cdf014118e215407b31..cccaaf5ea40eb4d62da4863e4e1b0682fd851f32 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundChatPacket.java
@@ -9,6 +9,7 @@ import net.minecraft.network.protocol.Packet;
public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
+ private static final int MAX_LENGTH = Short.MAX_VALUE * 8 + 8; // Paper
private final Component message;
public net.kyori.adventure.text.Component adventure$message; // Paper
public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot
@@ -39,9 +40,9 @@ public class ClientboundChatPacket implements Packet<ClientGamePacketListener> {
// buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below
// Paper start - don't nest if we don't need to so that we can preserve formatting
if (this.components.length == 1) {
- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]));
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components[0]), MAX_LENGTH); // Paper - use proper max length
} else {
- buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components));
+ buf.writeUtf(net.md_5.bungee.chat.ComponentSerializer.toString(this.components), MAX_LENGTH); // Paper - use proper max length
}
// Paper end
} else {

View File

@ -1,30 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 21 May 2019 02:34:04 +0100
Subject: [PATCH] improve CraftWorld#isChunkLoaded
getChunkAt will request the chunk using vanillas chunk loading system,
which while we're not going to load the chunk, does involve the server
waiting for the execution queue to get to our request; We can just query
the chunk status and get a response now, vs having to wait
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 7540be1005db97a20d44d55c0e59547113d6ad80..c7e919516254eabd21dc460be4569c44d1fe1176 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -288,13 +288,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@Override
public boolean isChunkLoaded(int x, int z) {
- return this.world.getChunkSource().isChunkLoaded(x, z);
+ return this.world.getChunkSource().getChunkAtIfLoadedImmediately(x, z) != null; // Paper
}
@Override
public boolean isChunkGenerated(int x, int z) {
try {
- return this.isChunkLoaded(x, z) || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null;
+ return this.world.getChunkSource().getChunkAtIfCachedImmediately(x, z) != null || this.world.getChunkSource().chunkMap.read(new ChunkPos(x, z)) != null; // Paper (TODO check if the first part can be removed)
} catch (IOException ex) {
throw new RuntimeException(ex);
}