Skip to content

Commit

Permalink
entity hider: add option to hide dead npcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam- committed Jun 17, 2022
1 parent c04b597 commit acfb7c6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,15 @@ default boolean hideProjectiles()
{
return false;
}

@ConfigItem(
position = 14,
keyName = "hideDeadNpcs",
name = "Hide Dead NPCs",
description = "Hides NPCs when their health reaches 0"
)
default boolean hideDeadNpcs()
{
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public class EntityHiderPlugin extends Plugin
private boolean hideLocalPlayer2D;
private boolean hideNPCs;
private boolean hideNPCs2D;
private boolean hideDeadNpcs;
private boolean hidePets;
private boolean hideAttackers;
private boolean hideProjectiles;
Expand Down Expand Up @@ -118,6 +119,7 @@ private void updateConfig()

hideNPCs = config.hideNPCs();
hideNPCs2D = config.hideNPCs2D();
hideDeadNpcs = config.hideDeadNpcs();

hidePets = config.hidePets();

Expand Down Expand Up @@ -187,6 +189,12 @@ else if (renderable instanceof NPC)
return !hidePets;
}

// dead npcs can also be interacting so prioritize it over the interacting check
if (npc.isDead() && hideDeadNpcs)
{
return false;
}

if (npc.getInteracting() == client.getLocalPlayer())
{
boolean b = hideAttackers;
Expand Down

0 comments on commit acfb7c6

Please sign in to comment.