From 99baa36800e38129db146e35ca1bcf3f638456fa Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 22 Sep 2023 16:26:10 -0700 Subject: [PATCH] re-add distance map patch --- .../Fix-dangerous-end-portal-logic.patch | 6 +- .../Optimise-nearby-player-lookups.patch | 0 ...erCloseEnoughForSpawning-to-use-dist.patch | 0 ...tance-map-to-optimise-entity-tracker.patch | 56 ++----------------- 4 files changed, 7 insertions(+), 55 deletions(-) rename patches/{unapplied => }/server/Optimise-nearby-player-lookups.patch (100%) rename patches/{unapplied => }/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch (100%) rename patches/{unapplied => }/server/Use-distance-map-to-optimise-entity-tracker.patch (88%) diff --git a/patches/server/Fix-dangerous-end-portal-logic.patch b/patches/server/Fix-dangerous-end-portal-logic.patch index f4db15ac0b..d17c618531 100644 --- a/patches/server/Fix-dangerous-end-portal-logic.patch +++ b/patches/server/Fix-dangerous-end-portal-logic.patch @@ -15,9 +15,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { - - public boolean updatingSectionStatus = false; - // Paper end + return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this)); + } + // Paper end - optimise entity tracking + // Paper start - make end portalling safe + public BlockPos portalBlock; + public ServerLevel portalWorld; diff --git a/patches/unapplied/server/Optimise-nearby-player-lookups.patch b/patches/server/Optimise-nearby-player-lookups.patch similarity index 100% rename from patches/unapplied/server/Optimise-nearby-player-lookups.patch rename to patches/server/Optimise-nearby-player-lookups.patch diff --git a/patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch similarity index 100% rename from patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch rename to patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch diff --git a/patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch similarity index 88% rename from patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch rename to patches/server/Use-distance-map-to-optimise-entity-tracker.patch index 1aa1b10ca7..7507f1807c 100644 --- a/patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/server/Use-distance-map-to-optimise-entity-tracker.patch @@ -141,8 +141,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - } + // Paper - delay this logic for the entity tracker tick, no need to duplicate it - int i = SectionPos.blockToSectionCoord(player.getBlockX()); - int j = SectionPos.blockToSectionCoord(player.getBlockZ()); + SectionPos sectionposition = player.getLastSectionPos(); + SectionPos sectionposition1 = SectionPos.of((EntityAccess) player); @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker @@ -187,57 +187,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return; + } + // Paper end - optimized tracker + // Paper - replaced by PlayerChunkLoader + List list = Lists.newArrayList(); - List list1 = this.level.players(); - ObjectIterator objectiterator = this.entityMap.values().iterator(); -@@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - })); - // Paper end - DebugPackets.sendPoiPacketsForChunk(this.level, chunk.getPos()); -- List list = Lists.newArrayList(); -- List list1 = Lists.newArrayList(); -- ObjectIterator objectiterator = this.entityMap.values().iterator(); -- -- while (objectiterator.hasNext()) { -- ChunkMap.TrackedEntity playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next(); -- Entity entity = playerchunkmap_entitytracker.entity; -- -- if (entity != player && entity.chunkPosition().equals(chunk.getPos())) { -- playerchunkmap_entitytracker.updatePlayer(player); -- if (entity instanceof Mob && ((Mob) entity).getLeashHolder() != null) { -- list.add(entity); -- } -- -- if (!entity.getPassengers().isEmpty()) { -- list1.add(entity); -- } -- } -- } -- -- Iterator iterator; -- Entity entity1; -- -- if (!list.isEmpty()) { -- iterator = list.iterator(); -- -- while (iterator.hasNext()) { -- entity1 = (Entity) iterator.next(); -- player.connection.send(new ClientboundSetEntityLinkPacket(entity1, ((Mob) entity1).getLeashHolder())); -- } -- } -- -- if (!list1.isEmpty()) { -- iterator = list1.iterator(); -- -- while (iterator.hasNext()) { -- entity1 = (Entity) iterator.next(); -- player.connection.send(new ClientboundSetPassengersPacket(entity1)); -- } -- } -+ // Paper - no longer needed - this was used to account for clients bugging out since they needed a chunk to store entities, but they no longer need a chunk - - } - @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastSectionPos = SectionPos.of((EntityAccess) entity); }