mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 04:25:26 +01:00
Apply last patch
This commit is contained in:
parent
619d7c93d8
commit
902691b636
@ -6,21 +6,13 @@ Subject: [PATCH] Use distance map to optimise entity tracker
|
||||
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
|
||||
index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218bb96a97e9 100644
|
||||
index 8d8bb430e44d7608a8aa44c7feb41797b8bbfb06..8c8f4829c32d469d983b8d07a33670455cd5713d 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -71,6 +71,7 @@ import net.minecraft.network.protocol.game.ClientboundSetEntityLinkPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket;
|
||||
import net.minecraft.network.protocol.game.DebugPackets;
|
||||
import io.papermc.paper.util.MCUtil;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListener;
|
||||
import net.minecraft.server.network.ServerPlayerConnection;
|
||||
import net.minecraft.util.CsvOutput;
|
||||
@@ -170,6 +171,23 @@ 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 playerChunkTickRangeMap;
|
||||
// Paper end - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
||||
@@ -157,6 +157,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
// Paper start - distance maps
|
||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
||||
+ // Paper start - use distance map to optimise tracker
|
||||
+ public static boolean isLegacyTrackingEntity(Entity entity) {
|
||||
+ return entity.isLegacyTrackingEntity;
|
||||
@ -35,13 +27,13 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
+ }
|
||||
+
|
||||
+ private int convertSpigotRangeToVanilla(final int vanilla) {
|
||||
+ return MinecraftServer.getServer().getScaledTrackingDistance(vanilla);
|
||||
+ return net.minecraft.server.MinecraftServer.getServer().getScaledTrackingDistance(vanilla);
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise tracker
|
||||
|
||||
void addPlayerToDistanceMaps(ServerPlayer player) {
|
||||
this.playerChunkManager.addPlayer(player); // Paper - replace chunk loader
|
||||
@@ -182,6 +200,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.level.playerChunkLoader.addPlayer(player); // Paper - replace chunk loader
|
||||
@@ -168,6 +185,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerMobDistanceMap.add(player, chunkX, chunkZ, io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player));
|
||||
}
|
||||
// Paper end - per player mob spawning
|
||||
@ -56,7 +48,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
}
|
||||
|
||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||
@@ -196,6 +222,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -178,6 +203,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerMobDistanceMap.remove(player);
|
||||
}
|
||||
// Paper end - per player mob spawning
|
||||
@ -68,7 +60,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
}
|
||||
|
||||
void updateMaps(ServerPlayer player) {
|
||||
@@ -209,6 +240,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -190,6 +220,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.playerMobDistanceMap.update(player, chunkX, chunkZ, io.papermc.paper.chunk.system.ChunkSystem.getTickViewDistance(player));
|
||||
}
|
||||
// Paper end - per player mob spawning
|
||||
@ -83,7 +75,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
}
|
||||
// Paper end
|
||||
// Paper start
|
||||
@@ -295,6 +334,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -276,6 +314,45 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.regionManagers.add(this.dataRegionManager);
|
||||
// Paper end
|
||||
this.playerMobDistanceMap = this.level.paperConfig().entities.spawning.perPlayerMobSpawns ? new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets) : null; // Paper
|
||||
@ -126,10 +118,10 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
+ this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise entity tracker
|
||||
// Paper start - optimise ChunkMap#anyPlayerCloseEnoughForSpawning
|
||||
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,
|
||||
@@ -1001,17 +1079,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
protected ChunkGenerator generator() {
|
||||
@@ -960,17 +1037,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void move(ServerPlayer player) {
|
||||
@ -148,7 +140,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
|
||||
int i = SectionPos.blockToSectionCoord(player.getBlockX());
|
||||
int j = SectionPos.blockToSectionCoord(player.getBlockZ());
|
||||
@@ -1110,7 +1178,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1054,7 +1121,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
|
||||
@ -157,7 +149,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
|
||||
@@ -1154,7 +1222,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1098,7 +1165,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
entity.tracker = null; // Paper - We're no longer tracked
|
||||
}
|
||||
|
||||
@ -195,9 +187,9 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
List<ServerPlayer> list = Lists.newArrayList();
|
||||
List<ServerPlayer> list1 = this.level.players();
|
||||
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
@@ -1261,46 +1359,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}));
|
||||
// Paper end
|
||||
@@ -1200,46 +1297,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
player.trackChunk(chunk.getPos(), (Packet) cachedDataPacket.getValue());
|
||||
DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos());
|
||||
- List<Entity> list = Lists.newArrayList();
|
||||
- List<Entity> list1 = Lists.newArrayList();
|
||||
@ -243,7 +235,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
|
||||
}
|
||||
|
||||
@@ -1355,6 +1414,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1294,6 +1352,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
|
||||
}
|
||||
|
||||
@ -287,7 +279,7 @@ index 4b7c39595302a738e6d4a1749473ef9c81f84fea..503a642165f6f1292c07e8a9e618218b
|
||||
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
|
||||
index 04a388bd3a89a27f0b75134ef781b5e22da633de..2c9a829c3376e8767627fc94bb063486c7d0d81c 100644
|
||||
index 909d0c96840724033bd907560db46d4cbb7f41aa..a9a845f6a7967d306ec935c4f32414053da591f0 100644
|
||||
--- a/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;
|
||||
@ -298,7 +290,7 @@ index 04a388bd3a89a27f0b75134ef781b5e22da633de..2c9a829c3376e8767627fc94bb063486
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -477,6 +478,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -481,6 +482,38 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
public boolean updatingSectionStatus = false;
|
||||
// Paper end
|
||||
@ -338,22 +330,10 @@ index 04a388bd3a89a27f0b75134ef781b5e22da633de..2c9a829c3376e8767627fc94bb063486
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
index 71225959e1b17974374b1fb998de573ea55d85a4..6ac5de214d0da921d0d0c822e7063f6738788cac 100644
|
||||
index 172d231adecf043f9f06b7f5e0365ae82327998d..8fca15099952626ee537f5ce3eefdfaa6518dc1b 100644
|
||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
@@ -25,6 +25,7 @@ public class TrackingRange
|
||||
{
|
||||
return defaultRange;
|
||||
}
|
||||
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return defaultRange; // Paper - enderdragon is exempt
|
||||
SpigotWorldConfig config = entity.level.spigotConfig;
|
||||
if ( entity instanceof ServerPlayer )
|
||||
{
|
||||
@@ -51,8 +52,48 @@ public class TrackingRange
|
||||
return config.displayTrackingRange;
|
||||
} else
|
||||
{
|
||||
- if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return ((net.minecraft.server.level.ServerLevel)(entity.getCommandSenderWorld())).getChunkSource().chunkMap.getEffectiveViewDistance(); // Paper - enderdragon is exempt
|
||||
@@ -55,4 +55,45 @@ public class TrackingRange
|
||||
return config.otherTrackingRange;
|
||||
}
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Ensure Entity AABB's are never invalid
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 909d0c96840724033bd907560db46d4cbb7f41aa..09d25fd53e7b8323531b42331065c0be55116331 100644
|
||||
index a9a845f6a7967d306ec935c4f32414053da591f0..886db1055c69f2b0ce7a5bf61e53d3b1119d2c19 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -688,8 +688,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -721,8 +721,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void setPos(double x, double y, double z) {
|
||||
@ -19,7 +19,7 @@ index 909d0c96840724033bd907560db46d4cbb7f41aa..09d25fd53e7b8323531b42331065c0be
|
||||
}
|
||||
|
||||
protected AABB makeBoundingBox() {
|
||||
@@ -4174,6 +4174,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4207,6 +4207,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public final void setPosRaw(double x, double y, double z) {
|
||||
@ -31,7 +31,7 @@ index 909d0c96840724033bd907560db46d4cbb7f41aa..09d25fd53e7b8323531b42331065c0be
|
||||
// Paper start - rewrite chunk system
|
||||
if (this.updatingSectionStatus) {
|
||||
LOGGER.error("Refusing to update position for entity " + this + " to position " + new Vec3(x, y, z) + " since it is processing a section status update", new Throwable());
|
||||
@@ -4197,6 +4202,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4230,6 +4235,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.levelCallback.onMove();
|
||||
}
|
||||
|
@ -31,10 +31,10 @@ index 600758b91ed8197ef615368e1ef5315dfa9666c6..e178effe00488139a250937a17144f77
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 09d25fd53e7b8323531b42331065c0be55116331..9bbd29f226b651afeb0db9e012b5e01da53df69b 100644
|
||||
index 886db1055c69f2b0ce7a5bf61e53d3b1119d2c19..d3088ffcf5f92ff5c49fe8b25292ef176ac6c3f3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -158,6 +158,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -159,6 +159,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
// CraftBukkit start
|
||||
private static final int CURRENT_LEVEL = 2;
|
||||
@ -42,7 +42,7 @@ index 09d25fd53e7b8323531b42331065c0be55116331..9bbd29f226b651afeb0db9e012b5e01d
|
||||
static boolean isLevelAtLeast(CompoundTag tag, int level) {
|
||||
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
|
||||
}
|
||||
@@ -1823,6 +1824,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -1856,6 +1857,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 9bbd29f226b651afeb0db9e012b5e01da53df69b..444407332d2663384b75769f701f8bf368bd4ed1 100644
|
||||
index d3088ffcf5f92ff5c49fe8b25292ef176ac6c3f3..93a8ff684cf88ee7693ed308020d02cb18ded06f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4411,4 +4411,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4444,4 +4444,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
void accept(Entity entity, double x, double y, double z);
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 444407332d2663384b75769f701f8bf368bd4ed1..bae55a65fbd8c270395c9b56d129814fb1614520 100644
|
||||
index 93a8ff684cf88ee7693ed308020d02cb18ded06f..13459fec2555049dccc9b0437d42fd28f823dc46 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -4416,5 +4416,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4449,5 +4449,9 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
public static int nextEntityId() {
|
||||
return ENTITY_COUNTER.incrementAndGet();
|
||||
}
|
@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index bae55a65fbd8c270395c9b56d129814fb1614520..01ab92e1e0c316ef262ea53a4b534dbd71052f7a 100644
|
||||
index 13459fec2555049dccc9b0437d42fd28f823dc46..75c54f74290d98606661b74b14757c5731cdf848 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2016,6 +2016,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -2049,6 +2049,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
|
||||
public boolean isPushable() {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user