2018-09-29 01:31:59 +02:00
|
|
|
From 985660e1b67c134bedf39833962111048d6d395a Mon Sep 17 00:00:00 2001
|
2016-05-13 07:39:03 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Fri, 13 May 2016 01:38:06 -0400
|
|
|
|
Subject: [PATCH] Optimize EAR
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
2018-09-29 01:31:59 +02:00
|
|
|
index f52de10238..12040596df 100644
|
2016-05-13 07:39:03 +02:00
|
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
@@ -2,6 +2,8 @@ package org.spigotmc;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
+
|
|
|
|
+import co.aikar.timings.MinecraftTimings;
|
|
|
|
import net.minecraft.server.AxisAlignedBB;
|
|
|
|
import net.minecraft.server.Chunk;
|
|
|
|
import net.minecraft.server.Entity;
|
|
|
|
@@ -13,7 +15,7 @@ import net.minecraft.server.EntityCreature;
|
|
|
|
import net.minecraft.server.EntityCreeper;
|
|
|
|
import net.minecraft.server.EntityEnderCrystal;
|
|
|
|
import net.minecraft.server.EntityEnderDragon;
|
|
|
|
-import net.minecraft.server.EntityFallingBlock; // Paper
|
|
|
|
+import net.minecraft.server.EntityFallingBlock;
|
|
|
|
import net.minecraft.server.EntityFireball;
|
|
|
|
import net.minecraft.server.EntityFireworks;
|
|
|
|
import net.minecraft.server.EntityHuman;
|
2018-07-16 17:34:55 +02:00
|
|
|
@@ -21,17 +23,16 @@ import net.minecraft.server.EntityLiving;
|
2016-05-13 07:39:03 +02:00
|
|
|
import net.minecraft.server.EntityMonster;
|
|
|
|
import net.minecraft.server.EntityProjectile;
|
|
|
|
import net.minecraft.server.EntitySheep;
|
|
|
|
-import net.minecraft.server.EntitySlice;
|
|
|
|
import net.minecraft.server.EntitySlime;
|
|
|
|
import net.minecraft.server.EntityTNTPrimed;
|
2018-07-16 17:34:55 +02:00
|
|
|
import net.minecraft.server.EntityThrownTrident;
|
2016-05-13 07:39:03 +02:00
|
|
|
import net.minecraft.server.EntityVillager;
|
|
|
|
import net.minecraft.server.EntityWeather;
|
|
|
|
import net.minecraft.server.EntityWither;
|
|
|
|
+import net.minecraft.server.MCUtil;
|
|
|
|
import net.minecraft.server.MathHelper;
|
|
|
|
import net.minecraft.server.MinecraftServer;
|
|
|
|
import net.minecraft.server.World;
|
|
|
|
-import co.aikar.timings.MinecraftTimings;
|
|
|
|
|
|
|
|
public class ActivationRange
|
|
|
|
{
|
2018-07-16 17:34:55 +02:00
|
|
|
@@ -110,6 +111,7 @@ public class ActivationRange
|
2016-05-13 07:39:03 +02:00
|
|
|
maxRange = Math.max( maxRange, miscActivationRange );
|
2018-09-09 20:38:27 +02:00
|
|
|
//maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); Paper - Use player view distance API below instead
|
2016-05-13 07:39:03 +02:00
|
|
|
|
|
|
|
+ Chunk chunk; // Paper
|
|
|
|
for ( EntityHuman player : world.players )
|
|
|
|
{
|
2018-09-09 20:38:27 +02:00
|
|
|
int playerMaxRange = maxRange = Math.min( ( player.getViewDistance() << 4 ) - 8, maxRange ); // Paper - Use player view distance API
|
2018-07-16 17:34:55 +02:00
|
|
|
@@ -128,9 +130,9 @@ public class ActivationRange
|
2016-05-13 07:39:03 +02:00
|
|
|
{
|
|
|
|
for ( int j1 = k; j1 <= l; ++j1 )
|
|
|
|
{
|
|
|
|
- if ( world.getWorld().isChunkLoaded( i1, j1 ) )
|
|
|
|
+ if ( (chunk = MCUtil.getLoadedChunkWithoutMarkingActive(world, i1, j1 )) != null ) // Paper
|
|
|
|
{
|
|
|
|
- activateChunkEntities( world.getChunkAt( i1, j1 ) );
|
|
|
|
+ activateChunkEntities( chunk ); // Paper
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
--
|
2018-09-29 01:31:59 +02:00
|
|
|
2.19.0
|
2016-05-13 07:39:03 +02:00
|
|
|
|