Skip to content

Commit 43b64ec

Browse files
Fix Lootr trapped chests being displayed as normal chests
1 parent 2a5d70a commit 43b64ec

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/main/java/net/wurstclient/hacks/chestesp/groups/NormalChestsGroup.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import net.wurstclient.hacks.chestesp.ChestEspBlockGroup;
1616
import net.wurstclient.settings.CheckboxSetting;
1717
import net.wurstclient.settings.ColorSetting;
18+
import net.wurstclient.util.LootrModCompat;
1819

1920
public final class NormalChestsGroup extends ChestEspBlockGroup
2021
{
@@ -35,6 +36,7 @@ protected ColorSetting createColorSetting()
3536
protected boolean matches(BlockEntity be)
3637
{
3738
return be instanceof ChestBlockEntity
38-
&& !(be instanceof TrappedChestBlockEntity);
39+
&& !(be instanceof TrappedChestBlockEntity)
40+
&& !LootrModCompat.isLootrTrappedChest(be);
3941
}
4042
}

src/main/java/net/wurstclient/hacks/chestesp/groups/TrapChestsGroup.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import net.wurstclient.hacks.chestesp.ChestEspBlockGroup;
1515
import net.wurstclient.settings.CheckboxSetting;
1616
import net.wurstclient.settings.ColorSetting;
17+
import net.wurstclient.util.LootrModCompat;
1718

1819
public final class TrapChestsGroup extends ChestEspBlockGroup
1920
{
@@ -34,6 +35,7 @@ protected ColorSetting createColorSetting()
3435
@Override
3536
protected boolean matches(BlockEntity be)
3637
{
37-
return be instanceof TrappedChestBlockEntity;
38+
return be instanceof TrappedChestBlockEntity
39+
|| LootrModCompat.isLootrTrappedChest(be);
3840
}
3941
}

src/main/java/net/wurstclient/util/LootrModCompat.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ public enum LootrModCompat
2323
"noobanidus.mods.lootr.common.block.entity.LootrBarrelBlockEntity");
2424
private static final Class<?> lootrShulkerBoxClass = getClassIfExists(
2525
"noobanidus.mods.lootr.common.block.entity.LootrShulkerBlockEntity");
26+
private static final Class<?> lootrTrappedChestClass = getClassIfExists(
27+
"noobanidus.mods.lootr.common.block.entity.LootrTrappedChestBlockEntity");
2628

2729
public static boolean isLootrBarrel(BlockEntity blockEntity)
2830
{
@@ -40,6 +42,14 @@ public static boolean isLootrShulkerBox(BlockEntity blockEntity)
4042
return lootrShulkerBoxClass.isInstance(blockEntity);
4143
}
4244

45+
public static boolean isLootrTrappedChest(BlockEntity blockEntity)
46+
{
47+
if(blockEntity == null || lootrTrappedChestClass == null)
48+
return false;
49+
50+
return lootrTrappedChestClass.isInstance(blockEntity);
51+
}
52+
4353
private static Class<?> getClassIfExists(String name)
4454
{
4555
try

0 commit comments

Comments
 (0)