Keep a definsive copy of players for entity activation

This commit is contained in:
md_5 2013-02-16 19:46:08 +11:00
parent 60b7ce9918
commit c83471b860
1 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
From 21e9df28f07d8c883d274c1e7b57caa79488dc03 Mon Sep 17 00:00:00 2001
From f7e622680253de77248261ed9025946ceebb69e9 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Feb 2013 05:10:21 -0500
Date: Sat, 16 Feb 2013 19:45:09 +1100
Subject: [PATCH] Entity Activation Range# This feature gives 3 new
configurable ranges that if an entity of the matching type is outside of this
radius of any player, will tick at 5% of its normal rate.
@ -12,10 +12,10 @@ This change can have dramatic impact on gameplay if configured too low. Balance
.../java/net/minecraft/server/EntityArrow.java | 2 +-
src/main/java/net/minecraft/server/World.java | 10 +-
.../java/org/bukkit/craftbukkit/CraftWorld.java | 13 ++
src/main/java/org/bukkit/craftbukkit/Spigot.java | 148 +++++++++++++++++++++
src/main/java/org/bukkit/craftbukkit/Spigot.java | 149 +++++++++++++++++++++
.../java/org/bukkit/event/WorldTimingsHandler.java | 2 +
src/main/resources/configurations/bukkit.yml | 3 +
7 files changed, 184 insertions(+), 2 deletions(-)
7 files changed, 185 insertions(+), 2 deletions(-)
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d0a58f8..9da5035 100644
@ -137,12 +137,13 @@ index 21bd64a..a083ae4 100644
public Block getBlockAt(int x, int y, int z) {
diff --git a/src/main/java/org/bukkit/craftbukkit/Spigot.java b/src/main/java/org/bukkit/craftbukkit/Spigot.java
index 582dbab..04f8f56 100644
index 582dbab..75572f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/Spigot.java
+++ b/src/main/java/org/bukkit/craftbukkit/Spigot.java
@@ -1,7 +1,9 @@
@@ -1,7 +1,10 @@
package org.bukkit.craftbukkit;
+import java.util.ArrayList;
+import net.minecraft.server.*;
import org.bukkit.command.SimpleCommandMap;
import org.bukkit.configuration.file.YamlConfiguration;
@ -150,7 +151,7 @@ index 582dbab..04f8f56 100644
public class Spigot {
public static void initialize(CraftServer server, SimpleCommandMap commandMap, YamlConfiguration configuration) {
@@ -37,5 +39,151 @@ public class Spigot {
@@ -37,5 +40,151 @@ public class Spigot {
server.getLogger().severe("[Spigot] You should not disable chunk-gc. Resetting period-in-ticks to 600 ticks.");
server.chunkGCPeriod = 600;
}
@ -243,7 +244,7 @@ index 582dbab..04f8f56 100644
+ AxisAlignedBB animalBB = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
+ AxisAlignedBB monsterBB = AxisAlignedBB.a(0, 0, 0, 0, 0, 0);
+
+ for (Entity player : (List<Entity>) world.players) {
+ for (Entity player : new ArrayList<Entity>(world.players)) {
+ growBB(maxBB, player.boundingBox, maxRange, 256, maxRange);
+ growBB(miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange);
+ growBB(animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange);