Add PlayerEvent.StartTracking and .StopTracking & make trackedEntityIDs visible

& Update, as discussed on IRC (squash)
This commit is contained in:
diesieben07 committed 2014-05-30 01:59:05 +02:00
1 parent 4a6a49e073
commit deb5df542e
4 files changed
+92

No files matched your search

@@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
@@ -337,4 +337,23 @@
}
}
}
+
+ /* ======================================== FORGE START =====================================*/
+
+ // don't expose the EntityTrackerEntry directly so mods can't mess with the data in there as easily
+ /**
+ * Get all players tracking the given Entity. The Entity must be part of the World that this Tracker belongs to.
+ * @param entity the Entity
+ * @return all players tracking the Entity
+ */
+ public Set<net.minecraft.entity.player.EntityPlayer> getTrackingPlayers(Entity entity)
+ {
+ EntityTrackerEntry entry = (EntityTrackerEntry) field_72794_c.func_76041_a(entity.func_145782_y());
+ if (entry == null)
+ return java.util.Collections.emptySet();
+ else
+ return java.util.Collections.unmodifiableSet(entry.field_73134_o);
+ }
+
+ /* ======================================== FORGE END =====================================*/
}