80 Zeilen
4.6 KiB
Diff
80 Zeilen
4.6 KiB
Diff
Index: src/main/java/org/spigotmc/ActivationRange.java
|
|
IDEA additional info:
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|
<+>UTF-8
|
|
===================================================================
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java (revision 713ccb650354263ffcef76d86b2e31113a419181)
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java (date 1618247878918)
|
|
@@ -1,5 +1,6 @@
|
|
package org.spigotmc;
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
@@ -203,34 +204,41 @@
|
|
// Paper end
|
|
maxRange = Math.min( ( ((net.minecraft.server.WorldServer)world).getChunkProvider().playerChunkMap.getEffectiveViewDistance() << 4 ) - 8, maxRange ); // Paper - no-tick view distance
|
|
|
|
- for ( EntityHuman player : world.getPlayers() )
|
|
- {
|
|
+ //Steamwar Start
|
|
+ List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
|
|
+ int i = Integer.MAX_VALUE;
|
|
+ int j = Integer.MIN_VALUE;
|
|
+ int k = Integer.MAX_VALUE;
|
|
+ int l = Integer.MIN_VALUE;
|
|
+ for ( EntityHuman player : world.getPlayers() ) {
|
|
|
|
player.activatedTick = MinecraftServer.currentTick;
|
|
- maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
|
|
- ActivationType.MISC.boundingBox = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
|
|
- ActivationType.RAIDER.boundingBox = player.getBoundingBox().grow( raiderActivationRange, 256, raiderActivationRange );
|
|
- ActivationType.ANIMAL.boundingBox = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
|
|
- ActivationType.MONSTER.boundingBox = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );
|
|
+ maxBB = player.getBoundingBox().grow(maxRange, 256, maxRange);
|
|
+ ActivationType.MISC.boundingBox = player.getBoundingBox().grow(miscActivationRange, 256, miscActivationRange);
|
|
+ ActivationType.RAIDER.boundingBox = player.getBoundingBox().grow(raiderActivationRange, 256, raiderActivationRange);
|
|
+ ActivationType.ANIMAL.boundingBox = player.getBoundingBox().grow(animalActivationRange, 256, animalActivationRange);
|
|
+ ActivationType.MONSTER.boundingBox = player.getBoundingBox().grow(monsterActivationRange, 256, monsterActivationRange);
|
|
// Paper start
|
|
- ActivationType.WATER.boundingBox = player.getBoundingBox().grow( waterActivationRange, 256, waterActivationRange );
|
|
- ActivationType.FLYING_MONSTER.boundingBox = player.getBoundingBox().grow( flyingActivationRange, 256, flyingActivationRange );
|
|
- ActivationType.VILLAGER.boundingBox = player.getBoundingBox().grow( villagerActivationRange, 256, waterActivationRange );
|
|
+ ActivationType.WATER.boundingBox = player.getBoundingBox().grow(waterActivationRange, 256, waterActivationRange);
|
|
+ ActivationType.FLYING_MONSTER.boundingBox = player.getBoundingBox().grow(flyingActivationRange, 256, flyingActivationRange);
|
|
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().grow(villagerActivationRange, 256, waterActivationRange);
|
|
// Paper end
|
|
|
|
- int i = MathHelper.floor( maxBB.minX / 16.0D );
|
|
- int j = MathHelper.floor( maxBB.maxX / 16.0D );
|
|
- int k = MathHelper.floor( maxBB.minZ / 16.0D );
|
|
- int l = MathHelper.floor( maxBB.maxZ / 16.0D );
|
|
+ boundingBoxes.add(maxBB);
|
|
+ i = MathHelper.floor(maxBB.minX / 16.0D);
|
|
+ j = MathHelper.floor(maxBB.maxX / 16.0D);
|
|
+ k = MathHelper.floor(maxBB.minZ / 16.0D);
|
|
+ l = MathHelper.floor(maxBB.maxZ / 16.0D);
|
|
+ }
|
|
|
|
- for ( int i1 = i; i1 <= j; ++i1 )
|
|
- {
|
|
- for ( int j1 = k; j1 <= l; ++j1 )
|
|
- {
|
|
- Chunk chunk = chunkProvider.getChunkAtIfLoadedMainThreadNoCache( i1, j1 ); // Paper
|
|
- if ( chunk != null )
|
|
- {
|
|
- activateChunkEntities( chunk );
|
|
+ for ( int i1 = i; i1 <= j; ++i1 ) {
|
|
+ for (int j1 = k; j1 <= l; ++j1) {
|
|
+ for (AxisAlignedBB bb : boundingBoxes) {
|
|
+ if (bb.minX <= i1 && bb.maxX >= i1 && bb.minZ <= j1 && bb.maxZ >= j1) {
|
|
+ Chunk chunk = world.getChunkProvider().getChunkAt(i1, j1, false);
|
|
+ if (chunk != null)
|
|
+ activateChunkEntities(chunk);
|
|
+ break;
|
|
}
|
|
}
|
|
}
|