aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0991-Moonrise-optimisation-patches.patch
diff options
context:
space:
mode:
authorSpottedleaf <[email protected]>2024-07-15 09:56:17 -0700
committerSpottedleaf <[email protected]>2024-07-15 09:56:17 -0700
commit8b230185755c54a85194d85461f0a4262185c10c (patch)
treef06a0ae7a6c435c612df3fc3e092f5886f99c0ad /patches/server/0991-Moonrise-optimisation-patches.patch
parentaa929d66667e58929097dee3fd9499095c989392 (diff)
downloadPaper-8b230185755c54a85194d85461f0a4262185c10c.tar.gz
Paper-8b230185755c54a85194d85461f0a4262185c10c.zip
Avoid collision shapes outside world border in findFreePosition
This is to correctly adhere to Vanilla behavior.
Diffstat (limited to 'patches/server/0991-Moonrise-optimisation-patches.patch')
-rw-r--r--patches/server/0991-Moonrise-optimisation-patches.patch30
1 files changed, 20 insertions, 10 deletions
diff --git a/patches/server/0991-Moonrise-optimisation-patches.patch b/patches/server/0991-Moonrise-optimisation-patches.patch
index 6fa10ffaab..6b90527b4e 100644
--- a/patches/server/0991-Moonrise-optimisation-patches.patch
+++ b/patches/server/0991-Moonrise-optimisation-patches.patch
@@ -31308,7 +31308,7 @@ index bff83fe413c7baef4ba56a3270ea4463a58c792f..a248d859cbce48f4a34c4771a7acffc1
}
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
-index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73a5abf226 100644
+index e27d3547d1e19c137e05e6b8d075127a8bafb237..8b3522d2ff60d2ab79837b9cb32839c2f02efad5 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -81,6 +81,7 @@ import net.minecraft.world.level.storage.LevelData;
@@ -31328,7 +31328,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
public static final Codec<ResourceKey<Level>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
public static final ResourceKey<Level> OVERWORLD = ResourceKey.create(Registries.DIMENSION, ResourceLocation.withDefaultNamespace("overworld"));
-@@ -199,6 +200,441 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -199,6 +200,451 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@@ -31633,6 +31633,16 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
+ null
+ );
+
++ final WorldBorder worldBorder = this.getWorldBorder();
++ if (worldBorder != null) {
++ aabbs.removeIf((final AABB aabb) -> {
++ return !worldBorder.isWithinBounds(aabb);
++ });
++ voxels.removeIf((final VoxelShape shape) -> {
++ return !worldBorder.isWithinBounds(shape.bounds());
++ });
++ }
++
+ // push voxels into aabbs
+ for (int i = 0, len = voxels.size(); i < len; ++i) {
+ aabbs.addAll(voxels.get(i).toAabbs());
@@ -31770,7 +31780,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator) { // Paper - create paper world config
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
-@@ -281,6 +717,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -281,6 +727,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings
this.entityLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(this.spigotConfig.tileMaxTickTime);
@@ -31782,7 +31792,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
}
// Paper start - Cancel hit for vanished players
-@@ -549,7 +990,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -549,7 +1000,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
}
@@ -31791,7 +31801,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
this.sendBlockUpdated(blockposition, iblockdata1, iblockdata, i);
}
-@@ -813,6 +1254,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -813,6 +1264,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Iterator<TickingBlockEntity> iterator = this.blockEntityTickers.iterator();
boolean flag = this.tickRateManager().runsNormally();
@@ -31800,7 +31810,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
int tilesThisCycle = 0;
var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
toRemove.add(null); // Paper - Fix MC-117075
-@@ -828,6 +1271,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -828,6 +1281,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Spigot end
} else if (flag && this.shouldTickBlocksAt(tickingblockentity.getPos())) {
tickingblockentity.tick();
@@ -31812,7 +31822,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
}
}
this.blockEntityTickers.removeAll(toRemove); // Paper - Fix MC-117075
-@@ -850,12 +1298,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -850,12 +1308,20 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD);
// Paper end - Prevent block entity and entity crashes
}
@@ -31834,7 +31844,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
}
// Paper end - Option to prevent armor stands from doing entity lookups
-@@ -949,7 +1405,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -949,7 +1415,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Paper end - Perf: Optimize capturedTileEntities lookup
// CraftBukkit end
@@ -31843,7 +31853,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
}
public void setBlockEntity(BlockEntity blockEntity) {
-@@ -1039,28 +1495,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1039,28 +1505,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate) {
this.getProfiler().incrementCounter("getEntities");
@@ -31877,7 +31887,7 @@ index e27d3547d1e19c137e05e6b8d075127a8bafb237..a12ef61b42779e37d439585e479c7d73
}
@Override
-@@ -1075,36 +1516,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
+@@ -1075,36 +1526,77 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
}