Skip to content

Commit

Permalink
Don't think getEntityById is a function that can be fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
retrooper committed Aug 22, 2023
1 parent 23d0607 commit 6c6a253
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,7 @@ private static Entity getEntityByIdWithWorldUnsafe(World world, int id) {

@Nullable
private static Entity getEntityByIdUnsafe(World origin, int id) {
//This is bad code!
Entity e = getEntityByIdWithWorldUnsafe(origin, id);
if (e != null) {
return e;
Expand Down Expand Up @@ -849,7 +850,7 @@ public static Entity getEntityById(@Nullable World world, int entityID) {
try {
if (world != null) {
//On 1.17 we have to use hacks to get the entity list bypassing Spigot's checks
//We cannot recommend finding entity objects asynchronously.
//We strongly do not recommend finding entity objects asynchronously.
for (Entity entity : getEntityList(world)) {
if (entity.getEntityId() == entityID) {
ENTITY_ID_CACHE.putIfAbsent(entity.getEntityId(), entity);
Expand Down

0 comments on commit 6c6a253

Please sign in to comment.