use of net.minecraft.server.v1_16_R1.Chunk in project PaperDev by Kamillaova.
the class ActivationRange method activateEntities.
/**
* Find what entities are in range of the players in the world and set
* active if in range.
*/
public static void activateEntities(World world) {
MinecraftTimings.entityActivationCheckTimer.startTiming();
final int miscActivationRange = world.spigotConfig.miscActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
// Paper
final int waterActivationRange = world.spigotConfig.waterActivationRange;
int maxRange = Math.max(monsterActivationRange, animalActivationRange);
maxRange = Math.max(maxRange, miscActivationRange);
maxRange = Math.min((world.spigotConfig.viewDistance << 4) - 8, maxRange);
// Paper
Chunk chunk;
for (EntityHuman player : world.players) {
player.activatedTick = MinecraftServer.currentTick;
maxBB = player.getBoundingBox().grow(maxRange, 256, maxRange);
miscBB = player.getBoundingBox().grow(miscActivationRange, 256, miscActivationRange);
animalBB = player.getBoundingBox().grow(animalActivationRange, 256, animalActivationRange);
// Paper
waterBB = player.getBoundingBox().grow(waterActivationRange, 256, waterActivationRange);
monsterBB = player.getBoundingBox().grow(monsterActivationRange, 256, monsterActivationRange);
int i = MathHelper.floor(maxBB.a / 16.0D);
int j = MathHelper.floor(maxBB.d / 16.0D);
int k = MathHelper.floor(maxBB.c / 16.0D);
int l = MathHelper.floor(maxBB.f / 16.0D);
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (// Paper
(chunk = MCUtil.getLoadedChunkWithoutMarkingActive(world, i1, j1)) != null) {
// Paper
activateChunkEntities(chunk);
}
}
}
}
MinecraftTimings.entityActivationCheckTimer.stopTiming();
}
Aggregations