entity hider: add option to hide dead npcs

This commit is contained in:
Adam
2022-06-08 16:34:13 -04:00
parent c04b597228
commit acfb7c631d
2 changed files with 19 additions and 0 deletions

View File

@@ -176,4 +176,15 @@ public interface EntityHiderConfig extends Config
{
return false;
}
@ConfigItem(
position = 14,
keyName = "hideDeadNpcs",
name = "Hide Dead NPCs",
description = "Hides NPCs when their health reaches 0"
)
default boolean hideDeadNpcs()
{
return false;
}
}

View File

@@ -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;
@@ -118,6 +119,7 @@ public class EntityHiderPlugin extends Plugin
hideNPCs = config.hideNPCs();
hideNPCs2D = config.hideNPCs2D();
hideDeadNpcs = config.hideDeadNpcs();
hidePets = config.hidePets();
@@ -187,6 +189,12 @@ public class EntityHiderPlugin extends Plugin
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;