From 3ecca26a7b1e20c1faa8a0b88ce21afe785a3268 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Sat, 23 Sep 2023 09:38:10 +1000 Subject: [PATCH] Revert "re-add distance map patch" This reverts commit 99baa36800e38129db146e35ca1bcf3f638456fa. --- .../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, 55 insertions(+), 7 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 d17c618531..f4db15ac0b 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 { - return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this)); - } - // Paper end - optimise entity tracking + + public boolean updatingSectionStatus = false; + // Paper end + // Paper start - make end portalling safe + public BlockPos portalBlock; + public ServerLevel portalWorld; diff --git a/patches/server/Optimise-nearby-player-lookups.patch b/patches/unapplied/server/Optimise-nearby-player-lookups.patch similarity index 100% rename from patches/server/Optimise-nearby-player-lookups.patch rename to patches/unapplied/server/Optimise-nearby-player-lookups.patch diff --git a/patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch b/patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch similarity index 100% rename from patches/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch rename to patches/unapplied/server/Optimize-anyPlayerCloseEnoughForSpawning-to-use-dist.patch diff --git a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch b/patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch similarity index 88% rename from patches/server/Use-distance-map-to-optimise-entity-tracker.patch rename to patches/unapplied/server/Use-distance-map-to-optimise-entity-tracker.patch index 7507f1807c..1aa1b10ca7 100644 --- a/patches/server/Use-distance-map-to-optimise-entity-tracker.patch +++ b/patches/unapplied/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 - SectionPos sectionposition = player.getLastSectionPos(); - SectionPos sectionposition1 = SectionPos.of((EntityAccess) player); + int i = SectionPos.blockToSectionCoord(player.getBlockX()); + int j = SectionPos.blockToSectionCoord(player.getBlockZ()); @@ -0,0 +0,0 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker @@ -187,9 +187,57 @@ 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); }