More more work

This commit is contained in:
Nassim Jahnke 2022-07-27 22:17:18 +02:00
parent 08828fde02
commit 50710fa684
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
95 changed files with 234 additions and 255 deletions

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID
Use the world entity map instead of iterating over all players Use the world entity map instead of iterating over all players
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index aa77a3dbbcb77fb6f3ad070b83426042dd284aa0..9993b6a8f40896166c2f86befa7222c6e714da81 100644 index 7667c185178cf8cc15dd9c9b70402b1279e226a7..0cb83e84f8287bfaf170e78ed4cbce0ad00e3897 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -391,6 +391,14 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -392,6 +392,14 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
// Paper end // Paper end

View File

@ -15,10 +15,10 @@ This patch resolves the conflict by offsetting checking Spigot's entity
activation range check from an item's move method. activation range check from an item's move method.
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java 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 23506fd3a98c240606a00e29624012ae3bbab21a..a0de239a8497c906c2329131b14587637b0fdfcf 100644 index 95dc82a0a9bd8a3fa9c704696e7b3dc48bf4d6a0..ebcf58fe51d1fd0cb8a0f5a84cdd349f29c9442e 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -144,7 +144,7 @@ public class ItemEntity extends Entity { @@ -142,7 +142,7 @@ public class ItemEntity extends Entity {
} }
} }

View File

@ -7,10 +7,10 @@ When the server is lagging, players will wait longer when eating.
Change to also use a time check instead if it passes. Change to also use a time check instead if it passes.
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 90f6fcb6c0a53133ecf7d9adbd5e526e29be3fa2..dc885d9a20205bfa3b77e315ebe17287a6c3d4bf 100644 index 590b8af46f8e060aa568dde50025b4f4c6bb162e..383a892a5c34ec5e8f7d102f5a9bec11ae193c0e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3539,6 +3539,11 @@ public abstract class LivingEntity extends Entity { @@ -3542,6 +3542,11 @@ public abstract class LivingEntity extends Entity {
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
} }
@ -22,7 +22,7 @@ index 90f6fcb6c0a53133ecf7d9adbd5e526e29be3fa2..dc885d9a20205bfa3b77e315ebe17287
private void updatingUsingItem() { private void updatingUsingItem() {
if (this.isUsingItem()) { if (this.isUsingItem()) {
if (ItemStack.isSameIgnoreDurability(this.getItemInHand(this.getUsedItemHand()), this.useItem)) { if (ItemStack.isSameIgnoreDurability(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
@@ -3556,8 +3561,12 @@ public abstract class LivingEntity extends Entity { @@ -3559,8 +3564,12 @@ public abstract class LivingEntity extends Entity {
if (this.shouldTriggerItemUseEffects()) { if (this.shouldTriggerItemUseEffects()) {
this.triggerItemUseEffects(stack, 5); this.triggerItemUseEffects(stack, 5);
} }
@ -37,7 +37,7 @@ index 90f6fcb6c0a53133ecf7d9adbd5e526e29be3fa2..dc885d9a20205bfa3b77e315ebe17287
this.completeUsingItem(); this.completeUsingItem();
} }
@@ -3605,7 +3614,10 @@ public abstract class LivingEntity extends Entity { @@ -3608,7 +3617,10 @@ public abstract class LivingEntity extends Entity {
if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack; this.useItem = itemstack;
@ -49,7 +49,7 @@ index 90f6fcb6c0a53133ecf7d9adbd5e526e29be3fa2..dc885d9a20205bfa3b77e315ebe17287
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
this.setLivingEntityFlag(1, true); this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND); this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3630,7 +3642,10 @@ public abstract class LivingEntity extends Entity { @@ -3633,7 +3645,10 @@ public abstract class LivingEntity extends Entity {
} }
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) { } else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY; this.useItem = ItemStack.EMPTY;
@ -61,7 +61,7 @@ index 90f6fcb6c0a53133ecf7d9adbd5e526e29be3fa2..dc885d9a20205bfa3b77e315ebe17287
} }
} }
@@ -3763,7 +3778,10 @@ public abstract class LivingEntity extends Entity { @@ -3766,7 +3781,10 @@ public abstract class LivingEntity extends Entity {
} }
this.useItem = ItemStack.EMPTY; this.useItem = ItemStack.EMPTY;

View File

@ -14,7 +14,7 @@ Adds flying monsters to control ghast and phantoms
Adds villagers as separate config Adds villagers as separate config
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3261b07d9 100644 index 0cb83e84f8287bfaf170e78ed4cbce0ad00e3897..0013fdf7dd4074a9684eb4b93ea2735185c7ac1c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2,7 +2,6 @@ package net.minecraft.server.level; @@ -2,7 +2,6 @@ package net.minecraft.server.level;
@ -25,7 +25,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer; import com.mojang.datafixers.DataFixer;
import com.mojang.datafixers.util.Pair; import com.mojang.datafixers.util.Pair;
@@ -990,17 +989,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -991,17 +990,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
++TimingHistory.entityTicks; // Paper - timings ++TimingHistory.entityTicks; // Paper - timings
// Spigot start // Spigot start
co.aikar.timings.Timing timer; // Paper co.aikar.timings.Timing timer; // Paper
@ -47,7 +47,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
try { try {
// Paper end - timings // Paper end - timings
entity.setOldPosAndRot(); entity.setOldPosAndRot();
@@ -1011,9 +1010,13 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1012,9 +1011,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
return Registry.ENTITY_TYPE.getKey(entity.getType()).toString(); return Registry.ENTITY_TYPE.getKey(entity.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
@ -61,7 +61,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1021,13 +1024,18 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1022,13 +1025,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(entity, entity1); this.tickPassenger(entity, entity1);
} }
@ -81,7 +81,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
passenger.setOldPosAndRot(); passenger.setOldPosAndRot();
++passenger.tickCount; ++passenger.tickCount;
ProfilerFiller gameprofilerfiller = this.getProfiler(); ProfilerFiller gameprofilerfiller = this.getProfiler();
@@ -1036,8 +1044,17 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1037,8 +1045,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString(); return Registry.ENTITY_TYPE.getKey(passenger.getType()).toString();
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
@ -99,7 +99,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator(); Iterator iterator = passenger.getPassengers().iterator();
@@ -1047,6 +1064,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -1048,6 +1065,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.tickPassenger(passenger, entity2); this.tickPassenger(passenger, entity2);
} }
@ -108,7 +108,7 @@ index 9993b6a8f40896166c2f86befa7222c6e714da81..ff902ae5a96616bb70897d9326fc65a3
} else { } else {
passenger.stopRiding(); passenger.stopRiding();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 1ac0e8996ece6bd7be521a9a45fb8c398838b94e..79026ea84a6efca425b351467651332d2d3b9fdd 100644 index 5f613eac047703b6f1521fcd2d802e381d5f42d5..a9f1b5fe81bef3e948d128598407d23c723fc075 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -384,6 +384,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -384,6 +384,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@ -14,10 +14,10 @@ light engine on shutdown...
The queue size only puts a cap on max loss, doesn't solve that problem. The queue size only puts a cap on max loss, doesn't solve that problem.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a4bfec79fa93b45084adbf502d5900bc420300ab..51b33848d9a3af3a9b9dfe482f9f8d9150c57b82 100644 index 8be6de893f1df78afc0e2c023e548a50ff7c2629..b04c5433a1e2cdfe69c5b5cbe77b867ebd55c126 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -778,7 +778,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -780,7 +780,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.executeModerately(); this.executeModerately();
// CraftBukkit end // CraftBukkit end
if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper

View File

@ -154,10 +154,10 @@ index 0000000000000000000000000000000000000000..190df802cb24aa360f6cf4d291e38b4b
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 375f66bf1617e255b3465b736076a65e080eb36e..d95db45e21861eb9f1623c44dd797429ae158760 100644 index eae2472f6dfd166cb457953ab396f85ca8c3f0f9..8ab5fd86e626958646935e460b603c875b8a841b 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -141,6 +141,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -138,6 +138,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final ChunkTaskPriorityQueueSorter queueSorter; private final ChunkTaskPriorityQueueSorter queueSorter;
private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> worldgenMailbox; private final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> worldgenMailbox;
public final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> mainThreadMailbox; public final ProcessorHandle<ChunkTaskPriorityQueueSorter.Message<Runnable>> mainThreadMailbox;
@ -170,7 +170,7 @@ index 375f66bf1617e255b3465b736076a65e080eb36e..d95db45e21861eb9f1623c44dd797429
public final ChunkProgressListener progressListener; public final ChunkProgressListener progressListener;
private final ChunkStatusUpdateListener chunkStatusListener; private final ChunkStatusUpdateListener chunkStatusListener;
public final ChunkMap.ChunkDistanceManager distanceManager; public final ChunkMap.ChunkDistanceManager distanceManager;
@@ -264,11 +270,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -261,11 +267,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.progressListener = worldGenerationProgressListener; this.progressListener = worldGenerationProgressListener;
this.chunkStatusListener = chunkStatusChangeListener; this.chunkStatusListener = chunkStatusChangeListener;

View File

@ -1044,10 +1044,10 @@ index 7825d6f0fdcfda6212cff8033ec55fb7db236154..000853110c7a89f2d0403a7a2737025a
public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) { public ClientboundLevelChunkWithLightPacket(FriendlyByteBuf buf) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d95db45e21861eb9f1623c44dd797429ae158760..f15ad47696574d7668374729de44286258a36f3b 100644 index 8ab5fd86e626958646935e460b603c875b8a841b..993a74bb16116622dc968f1f240fed1c377de5fa 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -997,7 +997,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -994,7 +994,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
completablefuture1.thenAcceptAsync((either) -> { completablefuture1.thenAcceptAsync((either) -> {
either.ifLeft((chunk) -> { either.ifLeft((chunk) -> {
this.tickingGenerated.getAndIncrement(); this.tickingGenerated.getAndIncrement();
@ -1056,7 +1056,7 @@ index d95db45e21861eb9f1623c44dd797429ae158760..f15ad47696574d7668374729de442862
this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> {
this.playerLoadedChunk(entityplayer, mutableobject, chunk); this.playerLoadedChunk(entityplayer, mutableobject, chunk);
@@ -1176,7 +1176,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1173,7 +1173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (objectiterator.hasNext()) { while (objectiterator.hasNext()) {
ChunkHolder playerchunk = (ChunkHolder) objectiterator.next(); ChunkHolder playerchunk = (ChunkHolder) objectiterator.next();
ChunkPos chunkcoordintpair = playerchunk.getPos(); ChunkPos chunkcoordintpair = playerchunk.getPos();
@ -1065,7 +1065,7 @@ index d95db45e21861eb9f1623c44dd797429ae158760..f15ad47696574d7668374729de442862
this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> { this.getPlayers(chunkcoordintpair, false).forEach((entityplayer) -> {
SectionPos sectionposition = entityplayer.getLastSectionPos(); SectionPos sectionposition = entityplayer.getLastSectionPos();
@@ -1190,7 +1190,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1187,7 +1187,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
@ -1074,7 +1074,7 @@ index d95db45e21861eb9f1623c44dd797429ae158760..f15ad47696574d7668374729de442862
if (player.level == this.level) { if (player.level == this.level) {
if (newWithinViewDistance && !oldWithinViewDistance) { if (newWithinViewDistance && !oldWithinViewDistance) {
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong()); ChunkHolder playerchunk = this.getVisibleChunkIfPresent(pos.toLong());
@@ -1727,12 +1727,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1724,12 +1724,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
@ -1097,10 +1097,10 @@ index d95db45e21861eb9f1623c44dd797429ae158760..f15ad47696574d7668374729de442862
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
List<Entity> list1 = Lists.newArrayList(); List<Entity> list1 = Lists.newArrayList();
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index ff902ae5a96616bb70897d9326fc65a3261b07d9..57abbcd9d59ea29e2feb238ee342f28a66122006 100644 index 0013fdf7dd4074a9684eb4b93ea2735185c7ac1c..fb7954d4d4dbd35bf771b362f241294d79cf9933 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -402,7 +402,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -403,7 +403,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) { public ServerLevel(MinecraftServer minecraftserver, Executor executor, LevelStorageSource.LevelStorageAccess convertable_conversionsession, PrimaryLevelData iworlddataserver, ResourceKey<Level> resourcekey, LevelStem worlddimension, ChunkProgressListener worldloadlistener, boolean flag, long i, List<CustomSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
// Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
@ -1169,7 +1169,7 @@ index 4c1d34bd274d8e2a4003a286536652367da9488a..8e5e773fffcb17d20328903d1b1fc9d9
if (iblockdata1 == null) { if (iblockdata1 == null) {
// CraftBukkit start - remove blockstate if failed (or the same) // CraftBukkit start - remove blockstate if failed (or the same)
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
index 0d815a39d50bb8c06f81e3386764db6a00d84985..8dd9879d52ba9bd816fcfa5413ef3bfc25d562c7 100644 index 6cec5cda20531aadf8e2148908a70f8b573d7d82..dc164608bfb2fb18a1adf83fa10bac4028dcac0a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -99,17 +99,19 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom @@ -99,17 +99,19 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom
@ -1247,7 +1247,7 @@ index ae37e97e52557b48f129cc02eeea395378a48444..785fbcf9bafcdec1c5be213de3d85126
public int getSerializedSize() { public int getSerializedSize() {
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a187337884fe9e28 100644 index 78e20871e4bd8d92c4475f797a55733c68f6aeb4..34d8fbb441def2e89415729a2f39b9a32eec95c7 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -29,6 +29,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -29,6 +29,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@ -1258,30 +1258,22 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
private volatile PalettedContainer.Data<T> data; private volatile PalettedContainer.Data<T> data;
private final PalettedContainer.Strategy strategy; private final PalettedContainer.Strategy strategy;
private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer");
@@ -41,14 +42,19 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -41,7 +42,13 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
this.threadingDetector.checkAndUnlock(); this.threadingDetector.checkAndUnlock();
} }
- public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) { - public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {
- PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
+ // Paper start - Anti-Xray - Add preset values + // Paper start - Anti-Xray - Add preset values
+ @Deprecated @io.papermc.paper.annotation.DoNotUse public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) { return PalettedContainer.codecRW(idMap, codec, strategy, object, null); } + @Deprecated @io.papermc.paper.annotation.DoNotUse public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue) {return codecRW(idList, entryCodec, paletteProvider, defaultValue, null);}
+ public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object, T @org.jetbrains.annotations.Nullable [] presetValues) { + public static <T> Codec<PalettedContainer<T>> codecRW(IdMap<T> idList, Codec<T> entryCodec, PalettedContainer.Strategy paletteProvider, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) {
+ PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = (idMapx, strategyx, packedData) -> { + PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = (idMapx, strategyx, packedData) -> {
+ return unpack(idMapx, strategyx, packedData, object, presetValues); + return unpack(idMapx, strategyx, packedData, object, presetValues);
+ }; + };
+ // Paper end + // Paper end
return codec(idMap, codec, strategy, object, unpacker); PalettedContainerRO.Unpacker<T, PalettedContainer<T>> unpacker = PalettedContainer::unpack;
return codec(idList, entryCodec, paletteProvider, defaultValue, unpacker);
} }
@@ -65,19 +72,52 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public static <T> Codec<PalettedContainerRO<T>> codecRO(IdMap<T> idMap, Codec<T> codec, PalettedContainer.Strategy strategy, T object) {
PalettedContainerRO.Unpacker<T, PalettedContainerRO<T>> unpacker = (idMapx, strategyx, packedData) -> {
- return unpack(idMapx, strategyx, packedData).map((palettedContainer) -> {
+ return unpack(idMapx, strategyx, packedData, object, null).map((palettedContainer) -> { // Paper - Anti-Xray - Add preset values
return palettedContainer;
});
};
@@ -65,19 +71,52 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
}); });
} }
@ -1337,7 +1329,7 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
this.strategy = paletteProvider; this.strategy = paletteProvider;
this.registry = idList; this.registry = idList;
this.data = this.createOrReuseData((PalettedContainer.Data<T>)null, 0); this.data = this.createOrReuseData((PalettedContainer.Data<T>)null, 0);
@@ -92,11 +131,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -92,11 +132,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override @Override
public int onResize(int newBits, T object) { public int onResize(int newBits, T object) {
PalettedContainer.Data<T> data = this.data; PalettedContainer.Data<T> data = this.data;
@ -1372,7 +1364,7 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
public T getAndSet(int x, int y, int z, T value) { public T getAndSet(int x, int y, int z, T value) {
this.acquire(); this.acquire();
@@ -166,25 +227,36 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -166,25 +228,36 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
data.palette.read(buf); data.palette.read(buf);
buf.readLongArray(data.storage.getRaw()); buf.readLongArray(data.storage.getRaw());
this.data = data; this.data = data;
@ -1407,21 +1399,21 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
} }
- private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idMap, PalettedContainer.Strategy strategy, PalettedContainerRO.PackedData<T> packedData) { - private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized) {
+ private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idMap, PalettedContainer.Strategy strategy, PalettedContainerRO.PackedData<T> packedData, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values + private static <T> DataResult<PalettedContainer<T>> unpack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider, PalettedContainerRO.PackedData<T> serialized, T defaultValue, T @org.jetbrains.annotations.Nullable [] presetValues) { // Paper - Anti-Xray - Add preset values
List<T> list = packedData.paletteEntries(); List<T> list = serialized.paletteEntries();
int i = strategy.size(); int i = paletteProvider.size();
int j = strategy.calculateBitsForSerialization(idMap, list.size()); int j = paletteProvider.calculateBitsForSerialization(idList, list.size());
@@ -220,7 +292,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -220,7 +293,7 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
} }
} }
- return DataResult.success(new PalettedContainer<>(idMap, strategy, configuration, bitStorage, list)); - return DataResult.success(new PalettedContainer<>(idList, paletteProvider, configuration, bitStorage, list));
+ return DataResult.success(new PalettedContainer<>(idMap, strategy, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values + return DataResult.success(new PalettedContainer<>(idList, paletteProvider, configuration, bitStorage, list, defaultValue, presetValues)); // Paper - Anti-Xray - Add preset values
} }
@Override @Override
@@ -280,12 +352,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -280,12 +353,12 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
} }
public PalettedContainer<T> copy() { public PalettedContainer<T> copy() {
@ -1436,7 +1428,7 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
} }
@Override @Override
@@ -329,9 +401,20 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer @@ -329,9 +402,20 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8; return 1 + this.palette.getSerializedSize() + FriendlyByteBuf.getVarIntSize(this.storage.getSize()) + this.storage.getRaw().length * 8;
} }
@ -1459,12 +1451,12 @@ index 1152bf7f7a7784457c778b215db91b9e02066fba..c36de77b3124a519b3f324c5a1873378
} }
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
index e1c7a5909be7b8bf1156fc62b3965f3562c729e6..e561a45c5115c3c3930999b2a10108bc4fab99af 100644 index 9a2bf744abd8916d492e901be889223591bac3fd..a27fce0f1af9776a713bf1b5277869ed5d3e0c8e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java --- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java +++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainerRO.java
@@ -14,7 +14,10 @@ public interface PalettedContainerRO<T> { @@ -14,7 +14,10 @@ public interface PalettedContainerRO<T> {
void getAll(Consumer<T> consumer); void getAll(Consumer<T> action);
- void write(FriendlyByteBuf buf); - void write(FriendlyByteBuf buf);
+ // Paper start - Anti-Xray - Add chunk packet info + // Paper start - Anti-Xray - Add chunk packet info

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Implement alternative item-despawn-rate
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java 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 a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c09e7d3a32 100644 index ebcf58fe51d1fd0cb8a0f5a84cdd349f29c9442e..7e293167e73238f42fc213ee29d89aa775cf9e60 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -54,6 +54,7 @@ public class ItemEntity extends Entity { @@ -54,6 +54,7 @@ public class ItemEntity extends Entity {
@ -17,7 +17,7 @@ index a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c0
public ItemEntity(EntityType<? extends ItemEntity> type, Level world) { public ItemEntity(EntityType<? extends ItemEntity> type, Level world) {
super(type, world); super(type, world);
@@ -184,7 +185,7 @@ public class ItemEntity extends Entity { @@ -182,7 +183,7 @@ public class ItemEntity extends Entity {
} }
} }
@ -26,7 +26,7 @@ index a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c0
// CraftBukkit start - fire ItemDespawnEvent // CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0; this.age = 0;
@@ -208,7 +209,7 @@ public class ItemEntity extends Entity { @@ -206,7 +207,7 @@ public class ItemEntity extends Entity {
this.lastTick = MinecraftServer.currentTick; this.lastTick = MinecraftServer.currentTick;
// CraftBukkit end // CraftBukkit end
@ -35,7 +35,7 @@ index a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c0
// CraftBukkit start - fire ItemDespawnEvent // CraftBukkit start - fire ItemDespawnEvent
if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
this.age = 0; this.age = 0;
@@ -259,7 +260,7 @@ public class ItemEntity extends Entity { @@ -257,7 +258,7 @@ public class ItemEntity extends Entity {
private boolean isMergable() { private boolean isMergable() {
ItemStack itemstack = this.getItem(); ItemStack itemstack = this.getItem();
@ -44,7 +44,7 @@ index a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c0
} }
private void tryToMerge(ItemEntity other) { private void tryToMerge(ItemEntity other) {
@@ -503,6 +504,7 @@ public class ItemEntity extends Entity { @@ -501,6 +502,7 @@ public class ItemEntity extends Entity {
com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit com.google.common.base.Preconditions.checkArgument(!stack.isEmpty(), "Cannot drop air"); // CraftBukkit
this.getEntityData().set(ItemEntity.DATA_ITEM, stack); this.getEntityData().set(ItemEntity.DATA_ITEM, stack);
this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty this.getEntityData().markDirty(ItemEntity.DATA_ITEM); // CraftBukkit - SPIGOT-4591, must mark dirty
@ -52,7 +52,7 @@ index a0de239a8497c906c2329131b14587637b0fdfcf..b491186d66609046016370e56b96e2c0
} }
@Override @Override
@@ -566,7 +568,7 @@ public class ItemEntity extends Entity { @@ -564,7 +566,7 @@ public class ItemEntity extends Entity {
public void makeFakeItem() { public void makeFakeItem() {
this.setNeverPickUp(); this.setNeverPickUp();

View File

@ -8,10 +8,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code
Also ignores Enderdragon, defaulting it to Mojang's setting Also ignores Enderdragon, defaulting it to Mojang's setting
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f15ad47696574d7668374729de44286258a36f3b..a80d4620eadd78fcaa0786680766cee196c35f8d 100644 index 993a74bb16116622dc968f1f240fed1c377de5fa..1a06d0f8eedc4ef1e9a860c873aeff746669bfce 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1915,6 +1915,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1912,6 +1912,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
int j = entity.getType().clientTrackingRange() * 16; int j = entity.getType().clientTrackingRange() * 16;

View File

@ -13,10 +13,10 @@ Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks. heightmap resolves the issue without having to load all spawn chunks.
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 79026ea84a6efca425b351467651332d2d3b9fdd..22ea44067f742008e82114155867cecb841a67b3 100644 index a9f1b5fe81bef3e948d128598407d23c723fc075..8576fbaedf3076e8b492c499d4176b1116e7ef56 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3112,6 +3112,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3109,6 +3109,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (flag1) { if (flag1) {
blockposition1 = ServerLevel.END_SPAWN_POINT; blockposition1 = ServerLevel.END_SPAWN_POINT;
} else { } else {

View File

@ -252,10 +252,10 @@ index 0000000000000000000000000000000000000000..11de56afaf059b00fa5bec293516bcdc
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index a80d4620eadd78fcaa0786680766cee196c35f8d..e22a472bef6cc5b6b892379160aaea876084e8c8 100644 index 1a06d0f8eedc4ef1e9a860c873aeff746669bfce..f20b93c6372e36016b21591d3cd63c5d7a47721e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -159,6 +159,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -156,6 +156,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
private final Long2LongMap chunkSaveCooldowns; private final Long2LongMap chunkSaveCooldowns;
private final Queue<Runnable> unloadQueue; private final Queue<Runnable> unloadQueue;
int viewDistance; int viewDistance;
@ -263,7 +263,7 @@ index a80d4620eadd78fcaa0786680766cee196c35f8d..e22a472bef6cc5b6b892379160aaea87
// CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public final CallbackExecutor callbackExecutor = new CallbackExecutor();
@@ -188,16 +189,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -185,16 +186,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated // Note: players need to be explicitly added to distance maps before they can be updated
@ -295,7 +295,7 @@ index a80d4620eadd78fcaa0786680766cee196c35f8d..e22a472bef6cc5b6b892379160aaea87
} }
// Paper end // Paper end
// Paper start // Paper start
@@ -285,6 +301,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -282,6 +298,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new); this.dataRegionManager = new io.papermc.paper.chunk.SingleThreadChunkRegionManager(this.level, 2, (1.0 / 3.0), 1, 6, "Data", DataRegionData::new, DataRegionSectionData::new);
this.regionManagers.add(this.dataRegionManager); this.regionManagers.add(this.dataRegionManager);
// Paper end // Paper end
@ -303,7 +303,7 @@ index a80d4620eadd78fcaa0786680766cee196c35f8d..e22a472bef6cc5b6b892379160aaea87
} }
protected ChunkGenerator generator() { protected ChunkGenerator generator() {
@@ -306,6 +323,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -303,6 +320,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}); });
} }
@ -377,10 +377,10 @@ index d66ec02b09bb7ae46aae8e55f00626139f074ae3..de5b80fce9757517e51f2ef55340e884
this.lastSpawnState = spawnercreature_d; this.lastSpawnState = spawnercreature_d;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3ba550d0de4b88379331cf56fe114f7c7e0ea558..8421ecaec9a475163860966fea28ec66943b6f86 100644 index 628ef18b5043504f206c6b60b7805892870e5736..75bcab623004159f36a5a976c7b6f69873a108dd 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -234,6 +234,11 @@ public class ServerPlayer extends Player { @@ -235,6 +235,11 @@ public class ServerPlayer extends Player {
public boolean queueHealthUpdatePacket = false; public boolean queueHealthUpdatePacket = false;
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket; public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
// Paper end // Paper end
@ -392,7 +392,7 @@ index 3ba550d0de4b88379331cf56fe114f7c7e0ea558..8421ecaec9a475163860966fea28ec66
// CraftBukkit start // CraftBukkit start
public String displayName; public String displayName;
@@ -324,6 +329,7 @@ public class ServerPlayer extends Player { @@ -325,6 +330,7 @@ public class ServerPlayer extends Player {
this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getScoreboardName()); // Paper
this.bukkitPickUpLoot = true; this.bukkitPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth(); this.maxHealthCache = this.getMaxHealth();

View File

@ -310,10 +310,10 @@ index c12c03b9e79f264ee593373f8a72ed37c0ae8514..509b2ee115584ce80717cc12a7ab548d
chunkproviderserver_b.managedBlock(completablefuture::isDone); chunkproviderserver_b.managedBlock(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 57abbcd9d59ea29e2feb238ee342f28a66122006..2531592ba605b15f16d7438829de51de65d7305c 100644 index fb7954d4d4dbd35bf771b362f241294d79cf9933..8724396e7b2bb58b22c4f3262855f9f523dd6635 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -389,6 +389,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -390,6 +390,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
}; };
public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager;
// Paper end // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Entity Jump API
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index dc885d9a20205bfa3b77e315ebe17287a6c3d4bf..34509a40933eb48ad1fc745fa4ee7709cdd15b92 100644 index 383a892a5c34ec5e8f7d102f5a9bec11ae193c0e..878dd05e0a67a2c6bf48eab7f2d58bbfaf53d2d7 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3215,8 +3215,10 @@ public abstract class LivingEntity extends Entity { @@ -3218,8 +3218,10 @@ public abstract class LivingEntity extends Entity {
} else if (this.isInLava() && (!this.onGround || d7 > d8)) { } else if (this.isInLava() && (!this.onGround || d7 > d8)) {
this.jumpInLiquid(FluidTags.LAVA); this.jumpInLiquid(FluidTags.LAVA);
} else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) { } else if ((this.onGround || flag && d7 <= d8) && this.noJumpDelay == 0) {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Add option to nerf pigmen from nether portals
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 22ea44067f742008e82114155867cecb841a67b3..a2bc22baf3de2fa41e093347ae36845329498290 100644 index 8576fbaedf3076e8b492c499d4176b1116e7ef56..8bdaee1054f64fa5a0f4058ac3dc7d3626138ac4 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -386,6 +386,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -386,6 +386,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@ -16,7 +16,7 @@ index 22ea44067f742008e82114155867cecb841a67b3..a2bc22baf3de2fa41e093347ae368453
protected int numCollisions = 0; // Paper protected int numCollisions = 0; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@javax.annotation.Nullable @javax.annotation.Nullable
@@ -1983,6 +1984,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -1978,6 +1979,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (spawnedViaMobSpawner) { if (spawnedViaMobSpawner) {
nbt.putBoolean("Paper.FromMobSpawner", true); nbt.putBoolean("Paper.FromMobSpawner", true);
} }
@ -26,7 +26,7 @@ index 22ea44067f742008e82114155867cecb841a67b3..a2bc22baf3de2fa41e093347ae368453
// Paper end // Paper end
return nbt; return nbt;
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -2122,6 +2126,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2119,6 +2123,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status

View File

@ -125,10 +125,10 @@ index 6a00f3d38da8107825ab1d405f337fd077b09f72..d31b5ed47cffc61c90c926a0cd2005b7
public static void registerCommands(final MinecraftServer server) { public static void registerCommands(final MinecraftServer server) {
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 51b33848d9a3af3a9b9dfe482f9f8d9150c57b82..003d49ad608815171a0d183305509ec3590aedd4 100644 index b04c5433a1e2cdfe69c5b5cbe77b867ebd55c126..d8166025ddd229c065e8c4c3082549f1716c0384 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -235,6 +235,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -237,6 +237,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@Nullable private net.kyori.adventure.text.Component cachedMotd; // Paper @Nullable private net.kyori.adventure.text.Component cachedMotd; // Paper
private int playerIdleTimeout; private int playerIdleTimeout;
public final long[] tickTimes; public final long[] tickTimes;
@ -153,7 +153,7 @@ index 51b33848d9a3af3a9b9dfe482f9f8d9150c57b82..003d49ad608815171a0d183305509ec3
this.frameTimer.logFrameDuration(i1 - i); this.frameTimer.logFrameDuration(i1 - i);
this.profiler.pop(); this.profiler.pop();
org.spigotmc.WatchdogThread.tick(); // Spigot org.spigotmc.WatchdogThread.tick(); // Spigot
@@ -2505,4 +2516,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -2529,4 +2540,30 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static record ServerResourcePackInfo(String url, String hash, boolean isRequired, @Nullable Component prompt) { public static record ServerResourcePackInfo(String url, String hash, boolean isRequired, @Nullable Component prompt) {
} }

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization
Serializes using NBT which is safer for server data migrations than bukkits format. Serializes using NBT which is safer for server data migrations than bukkits format.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index d4e5b0d8fbd885a84ae854f2dcced0423a42b4f9..7d9a91b2afb6890a160c2cd1e1cf3f0fb6a10d92 100644 index bd8f051496aae64d317ae0cff9f21662f016c62b..61668447c4314562109e31bd5ca48da181e98529 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -431,6 +431,53 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -431,6 +431,53 @@ public final class CraftMagicNumbers implements UnsafeValues {

View File

@ -10,10 +10,10 @@ When not per player it will use the Vanilla mechanic of one delay per
world and the world age for the start day. 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 8421ecaec9a475163860966fea28ec66943b6f86..d777fa8dd3529faf14bf82d023e00e9a118b45e5 100644 index 75bcab623004159f36a5a976c7b6f69873a108dd..1c97da7c291c985bf53c88d569077edce1a2d662 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -230,6 +230,7 @@ public class ServerPlayer extends Player { @@ -231,6 +231,7 @@ public class ServerPlayer extends Player {
public boolean wonGame; public boolean wonGame;
private int containerUpdateDelay; // Paper private int containerUpdateDelay; // Paper
public long loginTime; // Paper public long loginTime; // Paper

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 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 diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0537678f802158ec182d48df94794b59820ffc7b..f33f38c3c8c277d208b00b64e1d0fa7bb5eda7ec 100644 index 115685012743e775ca3fa031e8a91b6cd2874236..637846c2dda1cf27c194ca4f16da454a62dc3f4b 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -397,11 +397,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -397,11 +397,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface

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. 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 diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e22a472bef6cc5b6b892379160aaea876084e8c8..07e397061420556b9f44314f0c459f5cdd30aad3 100644 index f20b93c6372e36016b21591d3cd63c5d7a47721e..dab266e62f837e0efe57c0c4ae33b84c553c969c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1648,6 +1648,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1645,6 +1645,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) { public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
@ -26,10 +26,10 @@ index e22a472bef6cc5b6b892379160aaea876084e8c8..07e397061420556b9f44314f0c459f5c
EntityType<?> entitytypes = entity.getType(); EntityType<?> entitytypes = entity.getType();
int i = entitytypes.clientTrackingRange() * 16; 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 diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 2531592ba605b15f16d7438829de51de65d7305c..cf0976f7352919197a322fb4f7f8e20c24509db5 100644 index 8724396e7b2bb58b22c4f3262855f9f523dd6635..e531c2ed2432b0184878cc3fcfe0bc91a551977c 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2291,7 +2291,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2292,7 +2292,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public void onTrackingStart(Entity entity) { public void onTrackingStart(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot
@ -38,7 +38,7 @@ index 2531592ba605b15f16d7438829de51de65d7305c..cf0976f7352919197a322fb4f7f8e20c
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity; ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -2325,6 +2325,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2326,6 +2326,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.valid = true; // CraftBukkit 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. 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index d777fa8dd3529faf14bf82d023e00e9a118b45e5..6469472fedd9f28a3d609714ddf7255824a7f72a 100644 index 1c97da7c291c985bf53c88d569077edce1a2d662..2b2810ee58eea7b703cb46690752f02c49cc0376 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -651,7 +651,7 @@ public class ServerPlayer extends Player { @@ -652,7 +652,7 @@ public class ServerPlayer extends Player {
public void doTick() { public void doTick() {
try { 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. 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 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 6b7aea148b7a979201dd51bf842a552644fd0a63..f1a1a251256646d0d3a457f1fc8af20ae085f5ef 100644 index d308c671ec1c4440777bccf1609ceca6670b98a8..0960e5ecc25fad3eb46a871c2749dd176b812460 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java --- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -1171,7 +1171,7 @@ public abstract class Player extends LivingEntity { @@ -1172,7 +1172,7 @@ public abstract class Player extends LivingEntity {
@Override @Override
protected boolean isImmobile() { 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. 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 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index f14d4bfd5ac03eeffefcf98e1077d915fd3fa2cb..d8b34055aff358cb2c236199da1e22d84213ea1e 100644 index be1bdcc99b3f2cc1103bce4ecdc5077bec6a1e85..f1bbfb0acbe79304b2e1c10221bc31b162e63959 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -795,6 +795,7 @@ public abstract class PlayerList { @@ -799,6 +799,7 @@ public abstract class PlayerList {
entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// CraftBukkit end // CraftBukkit end
@ -26,7 +26,7 @@ index f14d4bfd5ac03eeffefcf98e1077d915fd3fa2cb..d8b34055aff358cb2c236199da1e22d8
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ()); 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index a2bc22baf3de2fa41e093347ae36845329498290..6f1ff17fd75163ee7905a2e37f176813293652af 100644 index 8bdaee1054f64fa5a0f4058ac3dc7d3626138ac4..ccfb7dfe2327cd2e187ad7909342fc137fa126db 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -236,6 +236,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -236,6 +236,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {

View File

@ -10,10 +10,10 @@ larger than the keep loaded range.
By skipping this, we avoid potential for a large spike on server start. By skipping this, we avoid potential for a large spike on server start.
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6469472fedd9f28a3d609714ddf7255824a7f72a..6546991000cb40d1299497f21717d470d4ee7efb 100644 index 2b2810ee58eea7b703cb46690752f02c49cc0376..104d8dd2941da8153fdeb799c48f884c33e3e585 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -321,7 +321,7 @@ public class ServerPlayer extends Player { @@ -322,7 +322,7 @@ public class ServerPlayer extends Player {
this.stats = server.getPlayerList().getPlayerStats(this); this.stats = server.getPlayerList().getPlayerStats(this);
this.advancements = server.getPlayerList().getPlayerAdvancements(this); this.advancements = server.getPlayerList().getPlayerAdvancements(this);
this.maxUpStep = 1.0F; this.maxUpStep = 1.0F;
@ -22,7 +22,7 @@ index 6469472fedd9f28a3d609714ddf7255824a7f72a..6546991000cb40d1299497f21717d470
this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper
@@ -539,7 +539,7 @@ public class ServerPlayer extends Player { @@ -540,7 +540,7 @@ public class ServerPlayer extends Player {
position = Vec3.atCenterOf(((ServerLevel) world).getSharedSpawnPos()); position = Vec3.atCenterOf(((ServerLevel) world).getSharedSpawnPos());
} }
this.level = world; this.level = world;
@ -32,10 +32,10 @@ index 6469472fedd9f28a3d609714ddf7255824a7f72a..6546991000cb40d1299497f21717d470
this.gameMode.setLevel((ServerLevel) world); 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 diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d8b34055aff358cb2c236199da1e22d84213ea1e..d6b8796ed7eca4ba2af979fb5c2cbff4b92ae329 100644 index f1bbfb0acbe79304b2e1c10221bc31b162e63959..ca89bb5bf4de85ca22b004c91f2c7501bb133c55 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -214,6 +214,8 @@ public abstract class PlayerList { @@ -215,6 +215,8 @@ public abstract class PlayerList {
worldserver1 = worldserver; worldserver1 = worldserver;
} }

View File

@ -59,10 +59,10 @@ index 5a19e30a9b7e65a70f68a429b8ca741f788a303b..7b1843e16745ca8db2244e17490d2914
// Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the
// bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay.
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 8cc4cb2163a93b9491550fe6d0f5d980fb216920..4dd14d73a37b32288a64fbd67ee22c435b6e6d57 100644 index 336795dff742b7c6957fbd3476aff31d25a5e659..30a58229aa6dac5039511d0c0df5f2912ea7de9f 100644
--- a/src/main/java/net/minecraft/CrashReport.java --- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java
@@ -228,6 +228,7 @@ public class CrashReport { @@ -230,6 +230,7 @@ public class CrashReport {
} }
public static CrashReport forThrowable(Throwable cause, String title) { public static CrashReport forThrowable(Throwable cause, String title) {
@ -71,10 +71,10 @@ index 8cc4cb2163a93b9491550fe6d0f5d980fb216920..4dd14d73a37b32288a64fbd67ee22c43
cause = cause.getCause(); cause = cause.getCause();
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd1e8e2a90 100644 index d8166025ddd229c065e8c4c3082549f1716c0384..e25451056b6eedde2c5ffc281918ca13967e0a67 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -282,7 +282,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -284,7 +284,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>(); public java.util.Queue<Runnable> processQueue = new java.util.concurrent.ConcurrentLinkedQueue<Runnable>();
public int autosavePeriod; public int autosavePeriod;
public Commands vanillaCommandDispatcher; public Commands vanillaCommandDispatcher;
@ -83,7 +83,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
// CraftBukkit end // CraftBukkit end
// Spigot start // Spigot start
public static final int TPS = 20; public static final int TPS = 20;
@@ -293,6 +293,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -295,6 +295,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations;
public static long currentTickLong = 0L; // Paper public static long currentTickLong = 0L; // Paper
@ -93,7 +93,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) { public static <S extends MinecraftServer> S spin(Function<Thread, S> serverFactory) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> { Thread thread = new Thread(() -> {
@@ -865,6 +868,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -867,6 +870,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
private boolean hasStopped = false; private boolean hasStopped = false;
@ -101,7 +101,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
private final Object stopLock = new Object(); private final Object stopLock = new Object();
public final boolean hasStopped() { public final boolean hasStopped() {
synchronized (this.stopLock) { synchronized (this.stopLock) {
@@ -879,6 +883,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -881,6 +885,19 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return; if (this.hasStopped) return;
this.hasStopped = true; this.hasStopped = true;
} }
@ -121,7 +121,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
// CraftBukkit end // CraftBukkit end
if (this.metricsRecorder.isRecording()) { if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics(); this.cancelRecordingMetrics();
@@ -963,7 +980,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -965,7 +982,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper this.getProfileCache().save(false); // Paper
} }
// Spigot end // Spigot end
@ -140,7 +140,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
} }
public String getLocalIp() { public String getLocalIp() {
@@ -1056,6 +1084,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1058,6 +1086,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
protected void runServer() { protected void runServer() {
try { try {
@ -148,7 +148,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
if (!this.initServer()) { if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server"); throw new IllegalStateException("Failed to initialize server");
} }
@@ -1067,6 +1096,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1070,6 +1099,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status); this.updateStatusIcon(this.status);
// Spigot start // Spigot start
@ -167,7 +167,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
org.spigotmc.WatchdogThread.hasStarted = true; // Paper org.spigotmc.WatchdogThread.hasStarted = true; // Paper
Arrays.fill( recentTps, 20 ); Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -1121,6 +1162,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1124,6 +1165,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime); JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -237,7 +237,7 @@ index 003d49ad608815171a0d183305509ec3590aedd4..fe3faf1e8a102cd63c1976cf63403bbd
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager); 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 diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index f33f38c3c8c277d208b00b64e1d0fa7bb5eda7ec..e585cdd8a598df2b04c265d5568f8ba868018178 100644 index 637846c2dda1cf27c194ca4f16da454a62dc3f4b..648bc209938364a387c3f81dcd073db398e9f864 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -274,7 +274,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -274,7 +274,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -269,10 +269,10 @@ index f33f38c3c8c277d208b00b64e1d0fa7bb5eda7ec..e585cdd8a598df2b04c265d5568f8ba8
} }
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 07e397061420556b9f44314f0c459f5cdd30aad3..3afadbd25cb002966869db6e07cd26cf6d52646b 100644 index dab266e62f837e0efe57c0c4ae33b84c553c969c..48fc5d6ca854de036013586be634b3e05e2c52bc 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -592,6 +592,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -589,6 +589,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
MutableBoolean mutableboolean = new MutableBoolean(); MutableBoolean mutableboolean = new MutableBoolean();
do { do {
@ -281,10 +281,10 @@ index 07e397061420556b9f44314f0c459f5cdd30aad3..3afadbd25cb002966869db6e07cd26cf
list.stream().map((playerchunk) -> { list.stream().map((playerchunk) -> {
CompletableFuture completablefuture; CompletableFuture completablefuture;
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index d6b8796ed7eca4ba2af979fb5c2cbff4b92ae329..3459a7b74be03de8cf29ea1f54b7d54de2838911 100644 index ca89bb5bf4de85ca22b004c91f2c7501bb133c55..73d22c0f5f2998050de8a231677639c60f535229 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -516,7 +516,7 @@ public abstract class PlayerList { @@ -520,7 +520,7 @@ public abstract class PlayerList {
this.cserver.getPluginManager().callEvent(playerQuitEvent); this.cserver.getPluginManager().callEvent(playerQuitEvent);
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());

View File

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6546991000cb40d1299497f21717d470d4ee7efb..a39ee6af70cdd027dd5e7ddf7ed16393a2b08aab 100644 index 104d8dd2941da8153fdeb799c48f884c33e3e585..0b173c66aaab86ca33eb32ac912543ebcb7c380d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -620,7 +620,7 @@ public class ServerPlayer extends Player { @@ -621,7 +621,7 @@ public class ServerPlayer extends Player {
containerUpdateDelay = level.paperConfig().tickRates.containerUpdate; containerUpdateDelay = level.paperConfig().tickRates.containerUpdate;
} }
// Paper end // Paper end
@ -17,7 +17,7 @@ index 6546991000cb40d1299497f21717d470d4ee7efb..a39ee6af70cdd027dd5e7ddf7ed16393
this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper
this.containerMenu = this.inventoryMenu; this.containerMenu = this.inventoryMenu;
} }
@@ -1493,7 +1493,7 @@ public class ServerPlayer extends Player { @@ -1491,7 +1491,7 @@ public class ServerPlayer extends Player {
} else { } else {
// CraftBukkit start // CraftBukkit start
this.containerMenu = container; this.containerMenu = container;

View File

@ -7,10 +7,10 @@ Will not run if max entity craming is disabled and
the max collisions per entity is less than or equal to 0 the max collisions per entity is less than or equal to 0
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 34509a40933eb48ad1fc745fa4ee7709cdd15b92..f9ec497b3212a2c2d87edc4350d8479c6c20abbd 100644 index 878dd05e0a67a2c6bf48eab7f2d58bbfaf53d2d7..b3b3b163fb1a506fb048dba173517eeeaf2f8007 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3312,10 +3312,16 @@ public abstract class LivingEntity extends Entity { @@ -3315,10 +3315,16 @@ public abstract class LivingEntity extends Entity {
protected void serverAiStep() {} protected void serverAiStep() {}
protected void pushEntities() { protected void pushEntities() {

View File

@ -85,10 +85,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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a39ee6af70cdd027dd5e7ddf7ed16393a2b08aab..6550e7a3e3d0f8cf86b9f6d8d3435ed9fb597a86 100644 index 0b173c66aaab86ca33eb32ac912543ebcb7c380d..db8400c7ca9aad9aeee192427661c76778bf9e47 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1857,6 +1857,7 @@ public class ServerPlayer extends Player { @@ -1850,6 +1850,7 @@ public class ServerPlayer extends Player {
public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
public void updateOptions(ServerboundClientInformationPacket packet) { public void updateOptions(ServerboundClientInformationPacket packet) {
@ -97,7 +97,7 @@ index a39ee6af70cdd027dd5e7ddf7ed16393a2b08aab..6550e7a3e3d0f8cf86b9f6d8d3435ed9
if (getMainArm() != packet.mainHand()) { if (getMainArm() != packet.mainHand()) {
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT); 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 diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 226bfb38b8b1c3463e5527c831d22875cfc051ba..daea1ca1d3288b6c3b0cf2e58fe35cb5e4069698 100644 index c8b9c55c2d927ed5f9a0597822ceef95842abe5e..14dc5a18bffc4d8a7d3e786142a3fd853aaeeac4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -574,6 +574,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -574,6 +574,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

View File

@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproducible crash
for heightmaps. for heightmaps.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 3afadbd25cb002966869db6e07cd26cf6d52646b..71d76ce0d873c665597a7d28f6caea5bf059e796 100644 index 48fc5d6ca854de036013586be634b3e05e2c52bc..0fdf33bfab3191dbb582bc401f6f0b62aadacb4e 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -182,6 +182,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -179,6 +179,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}; };
// CraftBukkit end // CraftBukkit end
@ -36,7 +36,7 @@ index 3afadbd25cb002966869db6e07cd26cf6d52646b..71d76ce0d873c665597a7d28f6caea5b
// Paper start - distance maps // Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@@ -1026,16 +1027,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1023,16 +1024,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}); });
CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> { CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> completablefuture1 = completablefuture.thenApplyAsync((either) -> {
return either.mapLeft((list) -> { return either.mapLeft((list) -> {

View File

@ -28,10 +28,10 @@ receives a deterministic result, and should no longer require 1 tick
delays anymore. delays anymore.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 71d76ce0d873c665597a7d28f6caea5bf059e796..ee64657a838b9b661b8accc997b6d149d21bce56 100644 index 0fdf33bfab3191dbb582bc401f6f0b62aadacb4e..5187988a22b55ac783147afe455a139662b67f7d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1656,6 +1656,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1653,6 +1653,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
.printStackTrace(); .printStackTrace();
return; return;
} }
@ -40,10 +40,10 @@ index 71d76ce0d873c665597a7d28f6caea5bf059e796..ee64657a838b9b661b8accc997b6d149
if (!(entity instanceof EnderDragonPart)) { if (!(entity instanceof EnderDragonPart)) {
EntityType<?> entitytypes = entity.getType(); 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 diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 6550e7a3e3d0f8cf86b9f6d8d3435ed9fb597a86..ee6281551ccf57e1785f1e36f52bdfe2cd60cff2 100644 index db8400c7ca9aad9aeee192427661c76778bf9e47..3a40d6fe9edbd997dc9a6b8ac009c3f621ecfe51 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -253,6 +253,7 @@ public class ServerPlayer extends Player { @@ -254,6 +254,7 @@ public class ServerPlayer extends Player {
public double maxHealthCache; public double maxHealthCache;
public boolean joining = true; public boolean joining = true;
public boolean sentListPacket = false; public boolean sentListPacket = false;
@ -52,10 +52,10 @@ index 6550e7a3e3d0f8cf86b9f6d8d3435ed9fb597a86..ee6281551ccf57e1785f1e36f52bdfe2
public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837 100644 index 73d22c0f5f2998050de8a231677639c60f535229..b33a7cf936fec6c1c4d39f6c156d3e6fefa3e795 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -280,6 +280,12 @@ public abstract class PlayerList { @@ -281,6 +281,12 @@ public abstract class PlayerList {
this.playersByUUID.put(player.getUUID(), player); this.playersByUUID.put(player.getUUID(), player);
// this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
@ -68,7 +68,7 @@ index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244
// CraftBukkit start // CraftBukkit start
CraftPlayer bukkitPlayer = player.getBukkitEntity(); CraftPlayer bukkitPlayer = player.getBukkitEntity();
@@ -318,6 +324,8 @@ public abstract class PlayerList { @@ -322,6 +328,8 @@ public abstract class PlayerList {
player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{entityplayer1})); player.connection.send(new ClientboundPlayerInfoPacket(ClientboundPlayerInfoPacket.Action.ADD_PLAYER, new ServerPlayer[]{entityplayer1}));
} }
player.sentListPacket = true; player.sentListPacket = true;
@ -77,7 +77,7 @@ index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244
// CraftBukkit end // CraftBukkit end
player.connection.send(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn player.connection.send(new ClientboundSetEntityDataPacket(player.getId(), player.getEntityData(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
@@ -343,6 +351,11 @@ public abstract class PlayerList { @@ -347,6 +355,11 @@ public abstract class PlayerList {
playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect)); playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect));
} }
@ -89,7 +89,7 @@ index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); CompoundTag nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
// CraftBukkit start // CraftBukkit start
@@ -391,6 +404,10 @@ public abstract class PlayerList { @@ -395,6 +408,10 @@ public abstract class PlayerList {
} }
} }
@ -100,7 +100,7 @@ index 3459a7b74be03de8cf29ea1f54b7d54de2838911..ac0bae0f7ce766a67cf2dc2c5c35f244
player.initInventoryMenu(); player.initInventoryMenu();
// CraftBukkit - Moved from above, added world // CraftBukkit - Moved from above, added world
// Paper start - Add to collideRule team if needed // Paper start - Add to collideRule team if needed
@@ -400,6 +417,7 @@ public abstract class PlayerList { @@ -404,6 +421,7 @@ public abstract class PlayerList {
scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam); scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
} }
// Paper end // Paper end

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ee6281551ccf57e1785f1e36f52bdfe2cd60cff2..e7210672073de654a8cf1670642a2f2035dec635 100644 index 3a40d6fe9edbd997dc9a6b8ac009c3f621ecfe51..8dc31f65126db6b2527d4106a885cb9b6dbc7a75 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -181,6 +181,7 @@ public class ServerPlayer extends Player { @@ -182,6 +182,7 @@ public class ServerPlayer extends Player {
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_XZ = 32;
private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10;
public ServerGamePacketListenerImpl connection; public ServerGamePacketListenerImpl connection;
@ -16,7 +16,7 @@ index ee6281551ccf57e1785f1e36f52bdfe2cd60cff2..e7210672073de654a8cf1670642a2f20
public final MinecraftServer server; public final MinecraftServer server;
public final ServerPlayerGameMode gameMode; public final ServerPlayerGameMode gameMode;
private final PlayerAdvancements advancements; private final PlayerAdvancements advancements;
@@ -254,6 +255,7 @@ public class ServerPlayer extends Player { @@ -255,6 +256,7 @@ public class ServerPlayer extends Player {
public boolean joining = true; public boolean joining = true;
public boolean sentListPacket = false; public boolean sentListPacket = false;
public boolean supressTrackerForLogin = false; // Paper public boolean supressTrackerForLogin = false; // Paper
@ -37,20 +37,20 @@ index be677d437d17b74c6188ce1bd5fc6fdc228fd92f..78fbb4c3e52e900956ae0811aaf934c8
public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1); public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1);
public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 7b78a7f5e4257f929fd870913e27b6090fa882ce..21126008755c79990205359226a27546f08ec044 100644 index 97dc7785b50873ee132825bced24cdf2d8217a60..bb870abae77d8fbf107bc9596637d4fac204c501 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -238,6 +238,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -251,6 +251,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
private static final int NO_BLOCK_UPDATES_TO_ACK = -1; private static final int PENDING_MESSAGE_DISCONNECT_THRESHOLD = 4096;
public final Connection connection; public final Connection connection;
private final MinecraftServer server; private final MinecraftServer server;
+ public Runnable playerJoinReady; // Paper + public Runnable playerJoinReady; // Paper
public ServerPlayer player; public ServerPlayer player;
private int tickCount; private int tickCount;
private int ackBlockChangesUpTo = -1; private int ackBlockChangesUpTo = -1;
@@ -315,6 +316,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -343,6 +344,15 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
// CraftBukkit end
@Override
public void tick() { public void tick() {
+ // Paper start - login async + // Paper start - login async
+ Runnable playerJoinReady = this.playerJoinReady; + Runnable playerJoinReady = this.playerJoinReady;
@ -64,7 +64,7 @@ index 7b78a7f5e4257f929fd870913e27b6090fa882ce..21126008755c79990205359226a27546
if (this.ackBlockChangesUpTo > -1) { if (this.ackBlockChangesUpTo > -1) {
this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo)); this.send(new ClientboundBlockChangedAckPacket(this.ackBlockChangesUpTo));
this.ackBlockChangesUpTo = -1; this.ackBlockChangesUpTo = -1;
@@ -361,7 +371,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -389,7 +399,7 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.lastVehicle = null; this.lastVehicle = null;
this.clientVehicleIsFloating = false; this.clientVehicleIsFloating = false;
this.aboveGroundVehicleTickCount = 0; this.aboveGroundVehicleTickCount = 0;
@ -74,10 +74,10 @@ index 7b78a7f5e4257f929fd870913e27b6090fa882ce..21126008755c79990205359226a27546
this.server.getProfiler().push("keepAlive"); this.server.getProfiler().push("keepAlive");
// Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 8b5eddce4845619603ccfeec158d97cb86568e0d..ec2825b6d276b6200c4bec5580d012f1eaed722e 100644 index c501e41ed7dd41a51cb87d4cf7ac62d694601156..31a506e78264f354394afc37fb7ebb3d0c7d6ebd 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -93,7 +93,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -95,7 +95,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
} }
// Paper end // Paper end
} else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) { } else if (this.state == ServerLoginPacketListenerImpl.State.DELAY_ACCEPT) {
@ -86,7 +86,7 @@ index 8b5eddce4845619603ccfeec158d97cb86568e0d..ec2825b6d276b6200c4bec5580d012f1
if (entityplayer == null) { if (entityplayer == null) {
this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT; this.state = ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT;
@@ -192,7 +192,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -204,7 +204,7 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
} }
this.connection.send(new ClientboundGameProfilePacket(this.gameProfile)); this.connection.send(new ClientboundGameProfilePacket(this.gameProfile));
@ -96,10 +96,10 @@ index 8b5eddce4845619603ccfeec158d97cb86568e0d..ec2825b6d276b6200c4bec5580d012f1
try { try {
ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference ServerPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1480b8702 100644 index b33a7cf936fec6c1c4d39f6c156d3e6fefa3e795..c9f0aa145b3f05b42b134654a841e88d6c39c3d1 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -138,6 +138,7 @@ public abstract class PlayerList { @@ -139,6 +139,7 @@ public abstract class PlayerList {
private final IpBanList ipBans; private final IpBanList ipBans;
private final ServerOpList ops; private final ServerOpList ops;
private final UserWhiteList whitelist; private final UserWhiteList whitelist;
@ -107,7 +107,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
// CraftBukkit start // CraftBukkit start
// private final Map<UUID, ServerStatisticManager> stats; // private final Map<UUID, ServerStatisticManager> stats;
// private final Map<UUID, AdvancementDataPlayer> advancements; // private final Map<UUID, AdvancementDataPlayer> advancements;
@@ -177,6 +178,11 @@ public abstract class PlayerList { @@ -178,6 +179,11 @@ public abstract class PlayerList {
} }
public void placeNewPlayer(Connection connection, ServerPlayer player) { public void placeNewPlayer(Connection connection, ServerPlayer player) {
@ -119,7 +119,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
player.loginTime = System.currentTimeMillis(); // Paper player.loginTime = System.currentTimeMillis(); // Paper
GameProfile gameprofile = player.getGameProfile(); GameProfile gameprofile = player.getGameProfile();
GameProfileCache usercache = this.server.getProfileCache(); GameProfileCache usercache = this.server.getProfileCache();
@@ -190,7 +196,7 @@ public abstract class PlayerList { @@ -191,7 +197,7 @@ public abstract class PlayerList {
if (nbttagcompound != null && nbttagcompound.contains("bukkit")) { if (nbttagcompound != null && nbttagcompound.contains("bukkit")) {
CompoundTag bukkit = nbttagcompound.getCompound("bukkit"); CompoundTag bukkit = nbttagcompound.getCompound("bukkit");
s = bukkit.contains("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s; s = bukkit.contains("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
@ -128,7 +128,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
// CraftBukkit end // CraftBukkit end
if (nbttagcompound != null) { if (nbttagcompound != null) {
@@ -217,11 +223,15 @@ public abstract class PlayerList { @@ -218,11 +224,15 @@ public abstract class PlayerList {
if (nbttagcompound == null) player.fudgeSpawnLocation(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are.... if (nbttagcompound == null) player.fudgeSpawnLocation(worldserver1); // Paper - only move to spawn on first login, otherwise, stay where you are....
player.setLevel(worldserver1); player.setLevel(worldserver1);
@ -145,7 +145,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
// Spigot start - spawn location event // Spigot start - spawn location event
Player spawnPlayer = player.getBukkitEntity(); Player spawnPlayer = player.getBukkitEntity();
@@ -263,6 +273,52 @@ public abstract class PlayerList { @@ -264,6 +274,52 @@ public abstract class PlayerList {
player.getRecipeBook().sendInitialRecipeBook(player); player.getRecipeBook().sendInitialRecipeBook(player);
this.updateEntireScoreboard(worldserver1.getScoreboard(), player); this.updateEntireScoreboard(worldserver1.getScoreboard(), player);
this.server.invalidateStatus(); this.server.invalidateStatus();
@ -198,7 +198,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
MutableComponent ichatmutablecomponent; MutableComponent ichatmutablecomponent;
if (player.getGameProfile().getName().equalsIgnoreCase(s)) { if (player.getGameProfile().getName().equalsIgnoreCase(s)) {
@@ -504,6 +560,7 @@ public abstract class PlayerList { @@ -508,6 +564,7 @@ public abstract class PlayerList {
protected void save(ServerPlayer player) { protected void save(ServerPlayer player) {
if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit if (!player.getBukkitEntity().isPersistent()) return; // CraftBukkit
@ -206,7 +206,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
this.playerIo.save(player); this.playerIo.save(player);
ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit
@@ -531,7 +588,7 @@ public abstract class PlayerList { @@ -535,7 +592,7 @@ public abstract class PlayerList {
} }
PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName()))); PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(entityplayer.getBukkitEntity(), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getScoreboardName())));
@ -215,7 +215,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage());
if (server.isSameThread()) entityplayer.doTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) if (server.isSameThread()) entityplayer.doTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog)
@@ -576,6 +633,13 @@ public abstract class PlayerList { @@ -580,6 +637,13 @@ public abstract class PlayerList {
// this.advancements.remove(uuid); // this.advancements.remove(uuid);
// CraftBukkit end // CraftBukkit end
} }
@ -229,7 +229,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
// CraftBukkit start // CraftBukkit start
// this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
@@ -593,7 +657,7 @@ public abstract class PlayerList { @@ -597,7 +661,7 @@ public abstract class PlayerList {
this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); this.cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
// CraftBukkit end // CraftBukkit end
@ -238,7 +238,7 @@ index ac0bae0f7ce766a67cf2dc2c5c35f244e5a08837..4b9e030016bef762c01ace5181ade7d1
} }
// CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
@@ -612,6 +676,13 @@ public abstract class PlayerList { @@ -616,6 +680,13 @@ public abstract class PlayerList {
list.add(entityplayer); list.add(entityplayer);
} }
} }

View File

@ -7,10 +7,10 @@ The code following this has better support for null worlds to move
them back to the world spawn. 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 6f1ff17fd75163ee7905a2e37f176813293652af..c7f70ca9e4b19476b368f3c4133a36e7f310519b 100644 index ccfb7dfe2327cd2e187ad7909342fc137fa126db..15c551347badbd0177d57c2b7d3500006eb7e0f7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2099,9 +2099,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2096,9 +2096,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
bworld = server.getWorld(worldName); bworld = server.getWorld(worldName);
} }

View File

@ -5,7 +5,7 @@ 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f9ec497b3212a2c2d87edc4350d8479c6c20abbd..d6dc08d5501cc8b09cec3da107506760a99f5f81 100644 index b3b3b163fb1a506fb048dba173517eeeaf2f8007..1eb53dd9c0ddef725e96aa7d5f6e335fb48eec9e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -2090,7 +2090,16 @@ public abstract class LivingEntity extends Entity { @@ -2090,7 +2090,16 @@ public abstract class LivingEntity extends Entity {

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. 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 diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e02483337124390f7bf59 100644 index 15c551347badbd0177d57c2b7d3500006eb7e0f7..70978ba28cec4dd3e64bf380c0669b3bcf4a640b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2229,11 +2229,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2226,11 +2226,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} else { } else {
// CraftBukkit start - Capture drops for death event // CraftBukkit start - Capture drops for death event
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) { if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
@ -34,7 +34,7 @@ index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e024833371243
entityitem.setDefaultPickUpDelay(); entityitem.setDefaultPickUpDelay();
// CraftBukkit start // CraftBukkit start
@@ -2997,6 +2998,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -2994,6 +2995,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@Nullable @Nullable
public Entity teleportTo(ServerLevel worldserver, PositionImpl location) { public Entity teleportTo(ServerLevel worldserver, PositionImpl location) {
// CraftBukkit end // CraftBukkit end
@ -47,7 +47,7 @@ index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e024833371243
if (this.level instanceof ServerLevel && !this.isRemoved()) { if (this.level instanceof ServerLevel && !this.isRemoved()) {
this.level.getProfiler().push("changeDimension"); this.level.getProfiler().push("changeDimension");
// CraftBukkit start // CraftBukkit start
@@ -3023,6 +3030,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3020,6 +3027,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit end // CraftBukkit end
this.level.getProfiler().popPush("reloading"); this.level.getProfiler().popPush("reloading");
@ -59,7 +59,7 @@ index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e024833371243
Entity entity = this.getType().create(worldserver); Entity entity = this.getType().create(worldserver);
if (entity != null) { if (entity != null) {
@@ -3036,10 +3048,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3033,10 +3045,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// CraftBukkit start - Forward the CraftEntity to the new entity // CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity); this.getBukkitEntity().setHandle(entity);
entity.bukkitEntity = this.getBukkitEntity(); entity.bukkitEntity = this.getBukkitEntity();
@ -70,7 +70,7 @@ index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e024833371243
// CraftBukkit end // CraftBukkit end
} }
@@ -3160,7 +3168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -3157,7 +3165,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
} }
public boolean canChangeDimensions() { public boolean canChangeDimensions() {
@ -80,7 +80,7 @@ index c7f70ca9e4b19476b368f3c4133a36e7f310519b..7d6507ef6b50e62c2d5e024833371243
public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { 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 diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index d6dc08d5501cc8b09cec3da107506760a99f5f81..cf691b94b478dc058af706e1f2d13b51df231779 100644 index 1eb53dd9c0ddef725e96aa7d5f6e335fb48eec9e..4a2a8566c9d68f21a98774fcecac0f4fa43d88c4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1643,9 +1643,9 @@ public abstract class LivingEntity extends Entity { @@ -1643,9 +1643,9 @@ public abstract class LivingEntity extends Entity {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Validate PickItem Packet and kick for invalid
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 21126008755c79990205359226a27546f08ec044..de7d5711885bdba0222513e0a4818a1f23306bf0 100644 index bb870abae77d8fbf107bc9596637d4fac204c501..569a8b6889e7085e3e408ebd47a71e8b5af8ca5e 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -918,7 +918,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -960,7 +960,14 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
@Override @Override
public void handlePickItem(ServerboundPickItemPacket packet) { public void handlePickItem(ServerboundPickItemPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel()); PacketUtils.ensureRunningOnSameThread(packet, this, this.player.getLevel());

View File

@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9
+ } + }
+} +}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index fe3faf1e8a102cd63c1976cf63403bbd1e8e2a90..3de332f5b08a6f7651437f8f5579632de6d3ef77 100644 index e25451056b6eedde2c5ffc281918ca13967e0a67..af2d703fe3cb74ced502ca89c5bf6ca1f47474bb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -869,6 +869,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -871,6 +871,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
private boolean hasStopped = false; private boolean hasStopped = false;
public volatile boolean hasFullyShutdown = false; // Paper public volatile boolean hasFullyShutdown = false; // Paper
@ -40,7 +40,7 @@ index fe3faf1e8a102cd63c1976cf63403bbd1e8e2a90..3de332f5b08a6f7651437f8f5579632d
private final Object stopLock = new Object(); private final Object stopLock = new Object();
public final boolean hasStopped() { public final boolean hasStopped() {
synchronized (this.stopLock) { synchronized (this.stopLock) {
@@ -883,6 +884,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -885,6 +886,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.hasStopped) return; if (this.hasStopped) return;
this.hasStopped = true; this.hasStopped = true;
} }
@ -48,7 +48,7 @@ index fe3faf1e8a102cd63c1976cf63403bbd1e8e2a90..3de332f5b08a6f7651437f8f5579632d
// Paper start - kill main thread, and kill it hard // Paper start - kill main thread, and kill it hard
shutdownThread = Thread.currentThread(); shutdownThread = Thread.currentThread();
org.spigotmc.WatchdogThread.doStop(); // Paper org.spigotmc.WatchdogThread.doStop(); // Paper
@@ -1012,6 +1014,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1014,6 +1016,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
} }
public void safeShutdown(boolean flag, boolean isRestarting) { public void safeShutdown(boolean flag, boolean isRestarting) {
this.isRestarting = isRestarting; this.isRestarting = isRestarting;
@ -58,10 +58,10 @@ index fe3faf1e8a102cd63c1976cf63403bbd1e8e2a90..3de332f5b08a6f7651437f8f5579632d
this.running = false; this.running = false;
if (flag) { if (flag) {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index ec2825b6d276b6200c4bec5580d012f1eaed722e..e51c03e05c4407ad3a51e573a5e79b003f86d9f1 100644 index 31a506e78264f354394afc37fb7ebb3d0c7d6ebd..40b27dbdc15e07a6a9d63d41babe5ed0245c0e0b 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -206,6 +206,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener @@ -218,6 +218,11 @@ public class ServerLoginPacketListenerImpl implements TickablePacketListener, Se
} catch (Exception exception) { } catch (Exception exception) {
ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception); ServerLoginPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data"); MutableComponent ichatmutablecomponent = Component.translatable("multiplayer.disconnect.invalid_player_data");

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index de7d5711885bdba0222513e0a4818a1f23306bf0..ea83ac86eb392652c55c5a4a774481d631b76dd1 100644 index 569a8b6889e7085e3e408ebd47a71e8b5af8ca5e..408c2071ea8f99721bc13cf4da27a17e64bc9e8a 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1559,6 +1559,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1625,6 +1625,13 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
} }
public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) { public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<ClientboundPlayerPositionPacket.RelativeArgument> set, boolean flag) {

View File

@ -478,10 +478,10 @@ index 2d5494d2813b773e60ddba6790b750a9a08f21f8..7695bf44503f161523ea612ef8a884ae
} }
} }
diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java
index 4dd14d73a37b32288a64fbd67ee22c435b6e6d57..1a859fef0848cf23a672012e9764965ae1c07ec5 100644 index 30a58229aa6dac5039511d0c0df5f2912ea7de9f..abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96 100644
--- a/src/main/java/net/minecraft/CrashReport.java --- a/src/main/java/net/minecraft/CrashReport.java
+++ b/src/main/java/net/minecraft/CrashReport.java +++ b/src/main/java/net/minecraft/CrashReport.java
@@ -30,6 +30,7 @@ public class CrashReport { @@ -32,6 +32,7 @@ public class CrashReport {
private final SystemReport systemReport = new SystemReport(); private final SystemReport systemReport = new SystemReport();
public CrashReport(String message, Throwable cause) { public CrashReport(String message, Throwable cause) {
@ -490,7 +490,7 @@ index 4dd14d73a37b32288a64fbd67ee22c435b6e6d57..1a859fef0848cf23a672012e9764965a
this.exception = cause; this.exception = cause;
this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit this.systemReport.setDetail("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
diff --git a/src/main/java/net/minecraft/CrashReportCategory.java b/src/main/java/net/minecraft/CrashReportCategory.java diff --git a/src/main/java/net/minecraft/CrashReportCategory.java b/src/main/java/net/minecraft/CrashReportCategory.java
index 3941e14d1c3e6e688e28904948039c8b2200de5f..a4fda4a3bae9ce600e778b44cd3ef432a8b65667 100644 index f114d5dab86aa2cdd59c78406c9d82f9caededca..99fa9f1952ee7ed79b223ff210a658e4b119b3e4 100644
--- a/src/main/java/net/minecraft/CrashReportCategory.java --- a/src/main/java/net/minecraft/CrashReportCategory.java
+++ b/src/main/java/net/minecraft/CrashReportCategory.java +++ b/src/main/java/net/minecraft/CrashReportCategory.java
@@ -104,6 +104,7 @@ public class CrashReportCategory { @@ -104,6 +104,7 @@ public class CrashReportCategory {
@ -502,10 +502,10 @@ index 3941e14d1c3e6e688e28904948039c8b2200de5f..a4fda4a3bae9ce600e778b44cd3ef432
} }
} }
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 97166c362a5468e3f7e2fcfd5e318dc519bfbf6c..ed4587248fada36c4c206be1fa36fef42fc969e2 100644 index a18e2146c4398b45ae50623fc6800a78718f4c81..c06cb0f0e300c4d00b3aeed12772c38e8379cb0c 100644
--- a/src/main/java/net/minecraft/network/Connection.java --- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java +++ b/src/main/java/net/minecraft/network/Connection.java
@@ -66,13 +66,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> { @@ -62,13 +62,13 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}); });
public static final AttributeKey<ConnectionProtocol> ATTRIBUTE_PROTOCOL = AttributeKey.valueOf("protocol"); public static final AttributeKey<ConnectionProtocol> ATTRIBUTE_PROTOCOL = AttributeKey.valueOf("protocol");
public static final LazyLoadedValue<NioEventLoopGroup> NETWORK_WORKER_GROUP = new LazyLoadedValue<>(() -> { public static final LazyLoadedValue<NioEventLoopGroup> NETWORK_WORKER_GROUP = new LazyLoadedValue<>(() -> {
@ -522,21 +522,8 @@ index 97166c362a5468e3f7e2fcfd5e318dc519bfbf6c..ed4587248fada36c4c206be1fa36fef4
}); });
private final PacketFlow receiving; private final PacketFlow receiving;
private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue(); private final Queue<Connection.PacketHolder> queue = Queues.newConcurrentLinkedQueue();
diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
index 72932b13d71f71896f07810c8850eb45749ae2e6..5c92aa1cc1a7e7fd0b7a06ae9b21e734fab71c74 100644
--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
+++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundChatPacket.java
@@ -41,7 +41,7 @@ public class ServerboundChatPacket implements Packet<ServerGamePacketListener> {
// Spigot Start
private static final java.util.concurrent.ExecutorService executors = java.util.concurrent.Executors.newCachedThreadPool(
- new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).build() );
+ new com.google.common.util.concurrent.ThreadFactoryBuilder().setDaemon( true ).setNameFormat( "Async Chat Thread - #%d" ).setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(net.minecraft.server.MinecraftServer.LOGGER)).build() ); // Paper
public void handle(final ServerGamePacketListener listener) {
if ( !this.message.startsWith("/") )
{
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index e585cdd8a598df2b04c265d5568f8ba868018178..a44a9b4b3c78395cdd1d859407a880cb54386d86 100644 index 648bc209938364a387c3f81dcd073db398e9f864..e42df2956e2d852a5a4c8fdeda395a3efd32c44c 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -200,6 +200,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -200,6 +200,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@ -548,10 +535,10 @@ index e585cdd8a598df2b04c265d5568f8ba868018178..a44a9b4b3c78395cdd1d859407a880cb
paperConfigurations.initializeWorldDefaultsConfiguration(); paperConfigurations.initializeWorldDefaultsConfiguration();
org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash); org.spigotmc.WatchdogThread.doStart(org.spigotmc.SpigotConfig.timeoutTime, org.spigotmc.SpigotConfig.restartOnCrash);
diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java diff --git a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
index 78808e6239070121d36b6c377202d76e8fb3fa32..72fbc58f7d003b7af3c35e5fc504010307c7086b 100644 index a24ef433d0c9d06b86fd612978cfd6d877036791..1b38326c9a709536dc4cccf9af93aede98a1a782 100644
--- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java --- a/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
+++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java +++ b/src/main/java/net/minecraft/server/network/ServerConnectionListener.java
@@ -53,10 +53,10 @@ public class ServerConnectionListener { @@ -54,10 +54,10 @@ public class ServerConnectionListener {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
public static final LazyLoadedValue<NioEventLoopGroup> SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> { public static final LazyLoadedValue<NioEventLoopGroup> SERVER_EVENT_GROUP = new LazyLoadedValue<>(() -> {

View File

@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns
if any are still running after that delay just as reload does. if any are still running after that delay just as reload does.
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3de332f5b08a6f7651437f8f5579632de6d3ef77..1774d6011ea165a36576f283de6531eed873ee4c 100644 index af2d703fe3cb74ced502ca89c5bf6ca1f47474bb..8e74c4b6b5186663537be304cfe462bb462e92f9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -908,6 +908,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -910,6 +910,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// CraftBukkit start // CraftBukkit start
if (this.server != null) { if (this.server != null) {
this.server.disablePlugins(); this.server.disablePlugins();

View File

@ -49,7 +49,7 @@ index c488e069a19d4bf082c94032571fcc77c0bada50..d5e80a0d953e7792669f21011bc685ad
if (blockstate == null) { if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags);
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
index 0422e389e5b9577417d09490a15584ed5b885209..d63c320051b9d58c3503d268c7913673679c79dd 100644 index 77125720fcbeb7bfc180effb27cfb78c74832ce5..cb11cef117fc896ddcb40993ddb852a2e717c2ad 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java --- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -92,6 +92,19 @@ public class Block extends BlockBehaviour implements ItemLike { @@ -92,6 +92,19 @@ public class Block extends BlockBehaviour implements ItemLike {
@ -115,10 +115,10 @@ index 76720517cd2d82065eb8430cf854b536295341db..29755807fdb6c30e31c0ec2bbf33bed9
world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 942dae5116840a2e8a992f0830574ab2a315bdf1..0ff34d2c569fbeae95509abed343b1e2f593378a 100644 index 3ec96c7f2ad0d6ba8ad32a4aabb0292b5c2ff5b4..ad38a7ced7f3dc05fb3d133e9da39f0a5eb0915b 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -222,7 +222,7 @@ public abstract class BlockBehaviour { @@ -223,7 +223,7 @@ public abstract class BlockBehaviour {
/** @deprecated */ /** @deprecated */
@Deprecated @Deprecated
public boolean canBeReplaced(BlockState state, BlockPlaceContext context) { public boolean canBeReplaced(BlockState state, BlockPlaceContext context) {
@ -127,7 +127,7 @@ index 942dae5116840a2e8a992f0830574ab2a315bdf1..0ff34d2c569fbeae95509abed343b1e2
} }
/** @deprecated */ /** @deprecated */
@@ -726,6 +726,12 @@ public abstract class BlockBehaviour { @@ -727,6 +727,12 @@ public abstract class BlockBehaviour {
return ((Block) this.owner).builtInRegistryHolder(); return ((Block) this.owner).builtInRegistryHolder();
} }
@ -140,7 +140,7 @@ index 942dae5116840a2e8a992f0830574ab2a315bdf1..0ff34d2c569fbeae95509abed343b1e2
public Material getMaterial() { public Material getMaterial() {
return this.material; return this.material;
} }
@@ -823,7 +829,7 @@ public abstract class BlockBehaviour { @@ -824,7 +830,7 @@ public abstract class BlockBehaviour {
} }
public PushReaction getPistonPushReaction() { public PushReaction getPistonPushReaction() {

View File

@ -28,10 +28,10 @@ index 729c4b1763a24bac3c0764bea505555a32e54f57..37d7165dfd17da03428f8dbbbf95aa80
if (mutableInt.getValue() >= 15) { if (mutableInt.getValue() >= 15) {
return 15; return 15;
diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java diff --git a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
index 4252247acd5c71e46d90f454663a9737e22e2a61..d122475c1a9d340046c478087d3ff5bf1ff8932c 100644 index 56b8f6ac53e7598da4dea2180825242222f86731..ca710a20e8b97341616463f4058b61cf4999af28 100644
--- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java --- a/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
+++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java +++ b/src/main/java/net/minecraft/world/level/lighting/SkyLightEngine.java
@@ -14,6 +14,7 @@ import org.apache.commons.lang3.mutable.MutableInt; @@ -15,6 +15,7 @@ import org.apache.commons.lang3.mutable.MutableInt;
public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> { public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorage.SkyDataLayerStorageMap, SkyLightSectionStorage> {
private static final Direction[] DIRECTIONS = Direction.values(); private static final Direction[] DIRECTIONS = Direction.values();
private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST}; private static final Direction[] HORIZONTALS = new Direction[]{Direction.NORTH, Direction.SOUTH, Direction.WEST, Direction.EAST};
@ -39,7 +39,7 @@ index 4252247acd5c71e46d90f454663a9737e22e2a61..d122475c1a9d340046c478087d3ff5bf
public SkyLightEngine(LightChunkGetter chunkProvider) { public SkyLightEngine(LightChunkGetter chunkProvider) {
super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider)); super(chunkProvider, LightLayer.SKY, new SkyLightSectionStorage(chunkProvider));
@@ -25,7 +26,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag @@ -26,7 +27,7 @@ public final class SkyLightEngine extends LayerLightEngine<SkyLightSectionStorag
if (level >= 15) { if (level >= 15) {
return level; return level;
} else { } else {

View File

@ -18,10 +18,10 @@ index 3167f5c6be39757e3cc42cbb17ab0cf13a2fe470..3768a71491ef7836b9739bdaec7a077c
private static long encode(double value) { private static long encode(double value) {
return Mth.lfloor(value * 4096.0D); return Mth.lfloor(value * 4096.0D);
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ee64657a838b9b661b8accc997b6d149d21bce56..d6887ac56991eee37cff7f0d978b8f5977e43c39 100644 index 5187988a22b55ac783147afe455a139662b67f7d..9077af957d284e341ca8327cb837dc9b4bb3ffee 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1934,9 +1934,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1931,9 +1931,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void updatePlayer(ServerPlayer player) { public void updatePlayer(ServerPlayer player) {
org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot
if (player != this.entity) { if (player != this.entity) {

View File

@ -42,10 +42,10 @@ index 6e7d09cd48048957a14835b857ac708aafe8f664..4e8a79f2d3b6f52c6284bc9b0ce2423d
// Paper start // Paper start
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5 100644 index 9077af957d284e341ca8327cb837dc9b4bb3ffee..6e27a89af794d411cce3c1c932c1f4910cec889c 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -185,11 +185,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -182,11 +182,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper final CallbackExecutor chunkLoadConversionCallbackExecutor = new CallbackExecutor(); // Paper
// Paper start - distance maps // Paper start - distance maps
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
@ -69,7 +69,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
// Paper start - per player mob spawning // Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) { if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); this.playerMobDistanceMap.add(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance());
@@ -199,6 +211,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -196,6 +208,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
void removePlayerFromDistanceMaps(ServerPlayer player) { void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -80,7 +80,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
// Paper start - per player mob spawning // Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) { if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.remove(player); this.playerMobDistanceMap.remove(player);
@@ -210,6 +226,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -207,6 +223,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated // Note: players need to be explicitly added to distance maps before they can be updated
@ -88,7 +88,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
// Paper start - per player mob spawning // Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) { if (this.playerMobDistanceMap != null) {
this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance()); this.playerMobDistanceMap.update(player, chunkX, chunkZ, this.distanceManager.getSimulationDistance());
@@ -303,6 +320,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -300,6 +317,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.add(this.dataRegionManager); this.regionManagers.add(this.dataRegionManager);
// Paper end // Paper end
this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
@ -127,7 +127,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
} }
protected ChunkGenerator generator() { protected ChunkGenerator generator() {
@@ -558,6 +607,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -555,6 +604,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder = (ChunkHolder) this.pendingUnloads.remove(pos); holder = (ChunkHolder) this.pendingUnloads.remove(pos);
if (holder != null) { if (holder != null) {
holder.setTicketLevel(level); holder.setTicketLevel(level);
@ -135,7 +135,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
} else { } else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this); holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
// Paper start // Paper start
@@ -653,6 +703,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -650,6 +700,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j); ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
if (playerchunk != null) { if (playerchunk != null) {
@ -143,7 +143,7 @@ index d6887ac56991eee37cff7f0d978b8f5977e43c39..bc698f8aee7eb5f2dbc1affd24e9af9f
this.pendingUnloads.put(j, playerchunk); this.pendingUnloads.put(j, playerchunk);
this.modified = true; this.modified = true;
++i; ++i;
@@ -1418,43 +1469,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1415,43 +1466,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return this.anyPlayerCloseEnoughForSpawning(pos, false); return this.anyPlayerCloseEnoughForSpawning(pos, false);
} }
@ -357,10 +357,10 @@ index 42b4214a1319691e9a6cb0c5fafaeeff821f3f99..1d9a0f6effa1654609f4d0752ec69eed
} }
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e7210672073de654a8cf1670642a2f2035dec635..86574b86b02dc0b0814cc0d0540e82957f094025 100644 index 8dc31f65126db6b2527d4106a885cb9b6dbc7a75..be00b0f9c15e1e7c22c2d2ebf3063639520f2030 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -261,6 +261,7 @@ public class ServerPlayer extends Player { @@ -262,6 +262,7 @@ public class ServerPlayer extends Player {
// CraftBukkit end // CraftBukkit end
public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Use distance map to optimise entity tracker
Use the distance map to find candidate players for tracking. Use the distance map to find candidate players for tracking.
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9bbf920c60 100644 index 6e27a89af794d411cce3c1c932c1f4910cec889c..6188f35e2b5300b6ff4a16e4d6e0e4a846261f8a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java --- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -69,6 +69,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket; @@ -66,6 +66,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
import net.minecraft.network.protocol.game.DebugPackets; import net.minecraft.network.protocol.game.DebugPackets;
import net.minecraft.server.MCUtil; import net.minecraft.server.MCUtil;
@ -17,7 +17,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
import net.minecraft.server.level.progress.ChunkProgressListener; import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection; import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput; import net.minecraft.util.CsvOutput;
@@ -196,10 +197,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -193,10 +194,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick
public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap;
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
@ -53,7 +53,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
// Note: players need to be explicitly added to distance maps before they can be updated // Note: players need to be explicitly added to distance maps before they can be updated
this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
// Paper start - per player mob spawning // Paper start - per player mob spawning
@@ -211,6 +237,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -208,6 +234,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
void removePlayerFromDistanceMaps(ServerPlayer player) { void removePlayerFromDistanceMaps(ServerPlayer player) {
@ -65,7 +65,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
this.playerMobSpawnMap.remove(player); this.playerMobSpawnMap.remove(player);
this.playerChunkTickRangeMap.remove(player); this.playerChunkTickRangeMap.remove(player);
@@ -226,6 +257,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -223,6 +254,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
int chunkX = MCUtil.getChunkCoordinate(player.getX()); int chunkX = MCUtil.getChunkCoordinate(player.getX());
int chunkZ = MCUtil.getChunkCoordinate(player.getZ()); int chunkZ = MCUtil.getChunkCoordinate(player.getZ());
// Note: players need to be explicitly added to distance maps before they can be updated // Note: players need to be explicitly added to distance maps before they can be updated
@ -80,7 +80,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, DistanceManager.MOB_SPAWN_RANGE); // Paper - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
// Paper start - per player mob spawning // Paper start - per player mob spawning
if (this.playerMobDistanceMap != null) { if (this.playerMobDistanceMap != null) {
@@ -320,6 +359,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -317,6 +356,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.regionManagers.add(this.dataRegionManager); this.regionManagers.add(this.dataRegionManager);
// Paper end // Paper end
this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
@ -126,7 +126,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning // Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, this.playerChunkTickRangeMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets,
(ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, (ServerPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
@@ -1592,17 +1670,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1589,17 +1667,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} }
public void move(ServerPlayer player) { public void move(ServerPlayer player) {
@ -145,7 +145,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
int i = SectionPos.blockToSectionCoord(player.getBlockX()); int i = SectionPos.blockToSectionCoord(player.getBlockX());
int j = SectionPos.blockToSectionCoord(player.getBlockZ()); int j = SectionPos.blockToSectionCoord(player.getBlockZ());
@@ -1729,7 +1797,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1726,7 +1794,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker); this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
@ -154,7 +154,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
if (entity instanceof ServerPlayer) { if (entity instanceof ServerPlayer) {
ServerPlayer entityplayer = (ServerPlayer) entity; ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -1773,7 +1841,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1770,7 +1838,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
entity.tracker = null; // Paper - We're no longer tracked entity.tracker = null; // Paper - We're no longer tracked
} }
@ -192,7 +192,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
List<ServerPlayer> list = Lists.newArrayList(); List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players(); List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator(); ObjectIterator objectiterator = this.entityMap.values().iterator();
@@ -1849,23 +1947,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1846,23 +1944,31 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
List<Entity> list = Lists.newArrayList(); List<Entity> list = Lists.newArrayList();
List<Entity> list1 = Lists.newArrayList(); List<Entity> list1 = Lists.newArrayList();
@ -236,7 +236,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
Iterator iterator; Iterator iterator;
Entity entity1; Entity entity1;
@@ -1941,6 +2047,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -1938,6 +2044,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lastSectionPos = SectionPos.of((EntityAccess) entity); this.lastSectionPos = SectionPos.of((EntityAccess) entity);
} }
@ -280,7 +280,7 @@ index bc698f8aee7eb5f2dbc1affd24e9af9f7c1ad2d5..86cdc8951544c16f8dc5148bc2c7bf9b
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false; return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
} }
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7d6507ef6b50e62c2d5e02483337124390f7bf59..175f5400225584f1fedc940d967a3d6f8ede84c0 100644 index 70978ba28cec4dd3e64bf380c0669b3bcf4a640b..0f85956d4d1c98225ff7cff7abad217a124f0dfc 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -57,6 +57,7 @@ import net.minecraft.network.syncher.EntityDataSerializers; @@ -57,6 +57,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;

View File

@ -8,10 +8,10 @@ so inline where possible, and avoid the abstraction of the
Either class. Either class.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index cf0976f7352919197a322fb4f7f8e20c24509db5..443044aa09b80bdbbcd202b53d265c635b50015f 100644 index e531c2ed2432b0184878cc3fcfe0bc91a551977c..c3db29bc1b24a976617068a4ddae062857d61097 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -2250,19 +2250,22 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -2251,19 +2251,22 @@ public class ServerLevel extends Level implements WorldGenLevel {
} }
private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { private boolean isPositionTickingWithEntitiesLoaded(long chunkPos) {

View File

@ -15,15 +15,15 @@ allows the distance calculation to avoid overflow and work as intended.
This issue is being tracked in Mojira ticket MC-159283 This issue is being tracked in Mojira ticket MC-159283
diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java diff --git a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
index 8a5826d80f9275de1a2a6a2e23369dd1920f560f..6825feea42667a0f14c4c730e5f1ac970c654c56 100644 index 30b6c5839b0da1aea792b7e092f0fcf5e83835db..683474cd96d3a0cdfb3b22d0111c8d3231f01d92 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java --- a/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/DensityFunctions.java
@@ -501,7 +501,7 @@ public final class DensityFunctions { @@ -501,7 +501,7 @@ public final class DensityFunctions {
int l = j / 2; int j = z / 2;
int m = i % 2; int k = x % 2;
int n = j % 2; int l = z % 2;
- float f = 100.0F - Mth.sqrt((float)(i * i + j * j)) * 8.0F; - float f = 100.0F - Mth.sqrt((float)(x * x + z * z)) * 8.0F;
+ float f = 100.0F - Mth.sqrt((long) i * (long) i + (long) j * (long) j) * 8.0F; // Paper - cast ints to long to avoid integer overflow + float f = 100.0F - Mth.sqrt((long) x * (long) x + (long) z * (long) z) * 8.0F; // Paper - cast ints to long to avoid integer overflow
f = Mth.clamp(f, -100.0F, 80.0F); f = Mth.clamp(f, -100.0F, 80.0F);
for(int o = -12; o <= 12; ++o) { for(int m = -12; m <= 12; ++m) {

View File

@ -14,10 +14,10 @@ behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method. of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index ea83ac86eb392652c55c5a4a774481d631b76dd1..c03867ed9a66a408900cadf81b09704e415dfca6 100644 index 408c2071ea8f99721bc13cf4da27a17e64bc9e8a..a0f492b0c7783fc8c5ce2e1a60707ae2db74ab9f 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1373,6 +1373,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser @@ -1439,6 +1439,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9)); this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move