Skip to content

Commit

Permalink
ItemEspHack: ESP boxes with different color for filtered out items
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGradientHorizon committed May 12, 2024
1 parent 962cee7 commit f9c7f5a
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/main/java/net/wurstclient/hacks/ItemEspHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ public final class ItemEspHack extends Hack implements UpdateListener,
private final ColorSetting color = new ColorSetting("Color",
"Items will be highlighted in this color.", Color.YELLOW);

private final CheckboxSetting showFilteredOutItems = new CheckboxSetting(
"Render ESP boxes for filtered out items",
"If enabled, all items which were filtered out earlier by \"Items filter\" will be rendered but with ability to set different color.",
false);

private final ColorSetting filteredOutItemsColor =
new ColorSetting("Color for filtered out items",
"Filtered out items will be highlighted in this color.", Color.RED);

private final ArrayList<ItemEntity> items = new ArrayList<>();

public ItemEspHack()
Expand All @@ -73,6 +82,8 @@ public ItemEspHack()
addSetting(lines);
addSetting(itemsListFilter);
addSetting(color);
addSetting(showFilteredOutItems);
addSetting(filteredOutItemsColor);
}

@Override
Expand Down Expand Up @@ -153,7 +164,9 @@ private void renderBoxes(MatrixStack matrixStack, float partialTicks,

for(ItemEntity e : items)
{
if(shouldBeFiltered(e))
boolean ifFilterApplies = shouldBeFiltered(e);

if(ifFilterApplies && !showFilteredOutItems.isChecked())
continue;

matrixStack.push();
Expand All @@ -167,7 +180,8 @@ private void renderBoxes(MatrixStack matrixStack, float partialTicks,

GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_DEPTH_TEST);
float[] colorF = color.getColorF();
float[] colorF = ifFilterApplies ? filteredOutItemsColor.getColorF()
: color.getColorF();
RenderSystem.setShaderColor(colorF[0], colorF[1], colorF[2], 0.5F);

Box bb = new Box(-0.5, 0, -0.5, 0.5, 1, 0.5);
Expand Down

0 comments on commit f9c7f5a

Please sign in to comment.