mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-28 20:17:50 +01:00
Reuse object
This commit is contained in:
parent
69d7db688c
commit
8023034a8c
@ -186,7 +186,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder {
|
||||
}
|
||||
|
||||
private void updatePackets(boolean navigating) {
|
||||
if (++packetUpdateCount >= 20) {
|
||||
if (++packetUpdateCount >= 30) {
|
||||
Location current = getBukkitEntity().getLocation(packetLocationCache);
|
||||
Packet[] packets = new Packet[navigating ? 5 : 6];
|
||||
if (!navigating) {
|
||||
|
@ -62,11 +62,13 @@ public class NMS {
|
||||
private static Field LAND_SPEED_MODIFIER_FIELD;
|
||||
private static final Map<EntityType, Float> MOVEMENT_SPEEDS = Maps.newEnumMap(EntityType.class);
|
||||
private static Field NAVIGATION_WORLD_FIELD;
|
||||
private static final Location packetCacheLocation = new Location(null, 0, 0, 0);
|
||||
private static Field PATHFINDING_RANGE;
|
||||
private static final Random RANDOM = Util.getFastRandom();
|
||||
private static Set<Integer> SLAB_MATERIALS = Sets.newHashSet();
|
||||
private static Field SPEED_FIELD;
|
||||
private static Set<Integer> STAIR_MATERIALS = Sets.newHashSet();
|
||||
|
||||
private static Field THREAD_STOPPER;
|
||||
|
||||
public static void addOrRemoveFromPlayerList(LivingEntity bukkitEntity, boolean remove) {
|
||||
@ -232,7 +234,7 @@ public class NMS {
|
||||
if (ply == null || world != ply.getWorld()) {
|
||||
continue;
|
||||
}
|
||||
if (location.distanceSquared(ply.getLocation()) > radius) {
|
||||
if (location.distanceSquared(ply.getLocation(packetCacheLocation)) > radius) {
|
||||
continue;
|
||||
}
|
||||
for (Packet packet : packets) {
|
||||
|
Loading…
Reference in New Issue
Block a user