Skip to content

Commit 053e924

Browse files
committed
add: Hide Haunted Skulls from Soulweaver Gloves
1 parent 820c488 commit 053e924

File tree

5 files changed

+32
-2
lines changed

5 files changed

+32
-2
lines changed

src/main/java/codes/biscuit/skyblockaddons/asm/hooks/RenderManagerHook.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import codes.biscuit.skyblockaddons.core.Location;
77
import codes.biscuit.skyblockaddons.core.npc.NPCUtils;
88
import codes.biscuit.skyblockaddons.features.JerryPresent;
9+
import codes.biscuit.skyblockaddons.utils.ItemUtils;
910
import net.minecraft.client.Minecraft;
1011
import net.minecraft.client.entity.EntityOtherPlayerMP;
1112
import net.minecraft.client.particle.EntityFX;
@@ -20,6 +21,7 @@
2021
public class RenderManagerHook {
2122

2223
private static final int HIDE_RADIUS_SQUARED = 7 * 7;
24+
private static final String HAUNTED_SKULL_TEXTURE = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMmYyNGVkNjg3NTMwNGZhNGExZjBjNzg1YjJjYjZhNmE3MjU2M2U5ZjNlMjRlYTU1ZTE4MTc4NDUyMTE5YWE2NiJ9fX0=";
2325

2426
public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValue) {
2527
Minecraft mc = Minecraft.getMinecraft();
@@ -36,6 +38,15 @@ public static void shouldRender(Entity entityIn, ReturnValue<Boolean> returnValu
3638
}
3739
}
3840
}
41+
if (main.getConfigValues().isEnabled(Feature.HIDE_HAUNTED_SKULLS) && currentLocation == Location.THE_CATACOMBS) {
42+
if (entityIn instanceof EntityArmorStand && entityIn.isInvisible()) {
43+
EntityArmorStand armorStand = (EntityArmorStand) entityIn;
44+
String skullID = ItemUtils.getSkullTexture(armorStand.getEquipmentInSlot(4));
45+
if (HAUNTED_SKULL_TEXTURE.equals(skullID)) {
46+
returnValue.cancel();
47+
}
48+
}
49+
}
3950
if (mc.theWorld != null && main.getConfigValues().isEnabled(Feature.HIDE_PLAYERS_NEAR_NPCS) && currentLocation != Location.GUEST_ISLAND && currentLocation != Location.THE_CATACOMBS) {
4051
if (entityIn instanceof EntityOtherPlayerMP && !NPCUtils.isNPC(entityIn) && NPCUtils.isNearNPC(entityIn)) {
4152
returnValue.cancel();

src/main/java/codes/biscuit/skyblockaddons/core/Feature.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public enum Feature {
233233
FIRE_FREEZE_TIMER(238, "settings.fireFreezeTimer", new GuiFeatureData(EnumUtils.DrawType.TEXT, ColorCode.YELLOW), false, EnumUtils.FeatureSetting.FIRE_FREEZE_SOUND, EnumUtils.FeatureSetting.FIRE_FREEZE_WHEN_HOLDING),
234234
FIRE_FREEZE_SOUND(239, "", null, false),
235235
FIRE_FREEZE_WHEN_HOLDING(240, "", null, false),
236+
HIDE_HAUNTED_SKULLS(241, "settings.hideHauntedSkulls", null, true),
236237

237238

238239
WARNING_TIME(-1, "settings.warningDuration", null, false),

src/main/java/codes/biscuit/skyblockaddons/utils/EnumUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ public enum FeatureCredit {
311311
HANNIBAL2("Hannibal2", "github.com/hannibal00212", Feature.CRIMSON_ARMOR_ABILITY_STACKS, Feature.HIDE_TRUE_DEFENSE),
312312
JASON54("jason54jg", "github.com/jason54jg", Feature.INFERNO_SLAYER_TRACKER, Feature.INFERNO_COLOR_BY_RARITY, Feature.INFERNO_TEXT_MODE),
313313
SOULTWISTRUNE("soultwistrune", "github.com/soultwistrune", Feature.RIFTSTALKER_SLAYER_TRACKER, Feature.RIFTSTALKER_COLOR_BY_RARITY, Feature.RIFTSTALKER_TEXT_MODE),
314-
FIX3DLL("Fix3dll", "github.com/Fix3dll", Feature.FIRE_FREEZE_TIMER);
314+
FIX3DLL("Fix3dll", "github.com/Fix3dll", Feature.FIRE_FREEZE_TIMER, Feature.HIDE_HAUNTED_SKULLS);
315315

316316
private final Set<Feature> features;
317317
private final String author;

src/main/java/codes/biscuit/skyblockaddons/utils/ItemUtils.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import net.minecraft.item.ItemPickaxe;
1818
import net.minecraft.item.ItemStack;
1919
import net.minecraft.nbt.*;
20+
import net.minecraftforge.common.util.Constants;
2021
import org.apache.commons.lang3.text.WordUtils;
2122

2223
import java.io.ByteArrayOutputStream;
@@ -558,6 +559,22 @@ public static String getSkullOwnerID(ItemStack skull) {
558559
return null;
559560
}
560561

562+
/**
563+
* Given a skull ItemStack, returns the texture, or null if it doesn't exist.
564+
*/
565+
public static String getSkullTexture(ItemStack skull) {
566+
if (skull == null || !skull.hasTagCompound()) {
567+
return null;
568+
}
569+
570+
NBTTagCompound nbt = skull.getTagCompound();
571+
if (nbt.hasKey("SkullOwner", 10)) {
572+
return nbt.getCompoundTag("SkullOwner").getCompoundTag("Properties")
573+
.getTagList("textures", Constants.NBT.TAG_COMPOUND).getCompoundTagAt(0).getString("Value");
574+
}
575+
return null;
576+
}
577+
561578
public static NBTTagByteArray getCompressedNBT(ItemStack[] items) {
562579
if (items == null) {
563580
return null;

src/main/resources/lang/en_US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@
236236
"hideOnlyOutsideRift": "Hide only outside Rift Dimension",
237237
"fireFreezeTimer": "Fire Freeze Timer F3/M3",
238238
"fireFreezeSound": "When countdown hit 0 play sound",
239-
"fireFreezeWhenHolding": "Only show while holding Fire Freeze"
239+
"fireFreezeWhenHolding": "Only show while holding Fire Freeze",
240+
"hideHauntedSkulls": "Hide Haunted Skulls from Soulweaver Gloves"
240241
},
241242
"messages": {
242243
"enchants": "Enchants",

0 commit comments

Comments
 (0)