2015-03-22 17:38:04 +00:00
|
|
|
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
|
|
|
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
|
|
|
|
@@ -38,6 +38,7 @@
|
|
|
|
import net.minecraft.world.chunk.Chunk;
|
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
|
|
|
+import net.minecraft.server.MinecraftServer; // Spigot
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.registry.EntityRegistry;
|
|
|
|
|
2015-06-08 09:09:51 +00:00
|
|
|
@@ -45,8 +46,8 @@
|
|
|
|
{
|
2015-03-22 17:38:04 +00:00
|
|
|
private static final Logger logger = LogManager.getLogger();
|
|
|
|
private final WorldServer theWorld;
|
2015-06-08 09:09:51 +00:00
|
|
|
- private Set trackedEntities = new HashSet();
|
2015-03-22 17:38:04 +00:00
|
|
|
- private IntHashMap trackedEntityIDs = new IntHashMap();
|
2015-06-08 09:09:51 +00:00
|
|
|
+ private Set<EntityTrackerEntry> trackedEntities = new pw.prok.imagine.collections.IndirectSet<EntityTrackerEntry>();
|
2015-03-22 17:38:04 +00:00
|
|
|
+ public IntHashMap trackedEntityIDs = new IntHashMap(); // CraftBukkit - private -> public
|
|
|
|
private int entityViewDistance;
|
|
|
|
private static final String __OBFID = "CL_00001431";
|
|
|
|
|
2015-06-08 09:09:51 +00:00
|
|
|
@@ -73,7 +74,7 @@
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)iterator.next();
|
|
|
|
|
|
|
|
- if (entitytrackerentry.myEntity != entityplayermp)
|
|
|
|
+ if (entitytrackerentry != null && entitytrackerentry.myEntity != entityplayermp)
|
|
|
|
{
|
|
|
|
entitytrackerentry.tryStartWachingThis(entityplayermp);
|
|
|
|
}
|
2015-03-22 17:38:04 +00:00
|
|
|
@@ -184,6 +185,7 @@
|
|
|
|
|
|
|
|
public void addEntityToTracker(Entity p_72785_1_, int p_72785_2_, final int p_72785_3_, boolean p_72785_4_)
|
|
|
|
{
|
|
|
|
+ p_72785_2_ = org.spigotmc.TrackingRange.getEntityTrackingRange(p_72785_1_, p_72785_2_); // Spigot
|
|
|
|
if (p_72785_2_ > this.entityViewDistance)
|
|
|
|
{
|
|
|
|
p_72785_2_ = this.entityViewDistance;
|
2015-06-08 09:09:51 +00:00
|
|
|
@@ -246,6 +248,7 @@
|
|
|
|
while (iterator.hasNext())
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)iterator.next();
|
|
|
|
+ if (entitytrackerentry != null)
|
|
|
|
entitytrackerentry.removeFromWatchingList(entityplayermp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -267,12 +270,14 @@
|
|
|
|
while (iterator.hasNext())
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)iterator.next();
|
|
|
|
+ if (entitytrackerentry != null) {
|
|
|
|
entitytrackerentry.sendLocationToAllClients(this.theWorld.playerEntities);
|
|
|
|
|
|
|
|
if (entitytrackerentry.playerEntitiesUpdated && entitytrackerentry.myEntity instanceof EntityPlayerMP)
|
|
|
|
{
|
|
|
|
arraylist.add((EntityPlayerMP)entitytrackerentry.myEntity);
|
|
|
|
}
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < arraylist.size(); ++i)
|
|
|
|
@@ -284,12 +289,13 @@
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry)iterator1.next();
|
|
|
|
|
|
|
|
- if (entitytrackerentry1.myEntity != entityplayermp)
|
|
|
|
+ if (entitytrackerentry1 != null && entitytrackerentry1.myEntity != entityplayermp)
|
|
|
|
{
|
|
|
|
entitytrackerentry1.tryStartWachingThis(entityplayermp);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ ((pw.prok.imagine.collections.Indirect) trackedEntities).compat(theWorld.getTotalWorldTime() % 100 == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void func_151247_a(Entity p_151247_1_, Packet p_151247_2_)
|
|
|
|
@@ -319,6 +325,7 @@
|
|
|
|
while (iterator.hasNext())
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)iterator.next();
|
|
|
|
+ if (entitytrackerentry != null)
|
|
|
|
entitytrackerentry.removePlayerFromTracker(p_72787_1_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -331,7 +338,7 @@
|
|
|
|
{
|
|
|
|
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry)iterator.next();
|
|
|
|
|
|
|
|
- if (entitytrackerentry.myEntity != p_85172_1_ && entitytrackerentry.myEntity.chunkCoordX == p_85172_2_.xPosition && entitytrackerentry.myEntity.chunkCoordZ == p_85172_2_.zPosition)
|
|
|
|
+ if (entitytrackerentry != null && entitytrackerentry.myEntity != p_85172_1_ && entitytrackerentry.myEntity.chunkCoordX == p_85172_2_.xPosition && entitytrackerentry.myEntity.chunkCoordZ == p_85172_2_.zPosition)
|
|
|
|
{
|
|
|
|
entitytrackerentry.tryStartWachingThis(p_85172_1_);
|
|
|
|
}
|