From 65dd269c266650724c392b121855f87cdf4dbe2b Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 08:29:01 -0500 Subject: test --- .../skyblock/endermanslayer/BeaconHighlighter.java | 51 ++++++++++++++++++++++ .../hysky/skyblocker/skyblock/entity/MobGlow.java | 40 +++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java new file mode 100644 index 00000000..2dc64aff --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java @@ -0,0 +1,51 @@ +package de.hysky.skyblocker.skyblock.endermanslayer; + +import de.hysky.skyblocker.utils.Tickable; +import de.hysky.skyblocker.utils.render.RenderHelper; +import de.hysky.skyblocker.utils.render.Renderable; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.minecraft.block.Block; +import net.minecraft.client.MinecraftClient; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtString; +import net.minecraft.util.math.BlockPos; + +public class BeaconHighlighter implements Tickable, Renderable { + BlockPos pos = null; + @Override + public void tick(MinecraftClient client) { + var player = MinecraftClient.getInstance().player; + var world = MinecraftClient.getInstance().world; + pos = null; + if(player != null && world != null) { + for(int x = (int) (player.getX()-20); x Date: Thu, 18 Jan 2024 09:20:11 -0500 Subject: improve beacons --- .../skyblocker/skyblock/end/BeaconHighlighter.java | 68 ++++++++++++++++++++++ .../skyblock/endermanslayer/BeaconHighlighter.java | 62 -------------------- 2 files changed, 68 insertions(+), 62 deletions(-) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java delete mode 100644 src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java new file mode 100644 index 00000000..1815179f --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -0,0 +1,68 @@ +package de.hysky.skyblocker.skyblock.end; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.utils.render.RenderHelper; +import de.hysky.skyblocker.utils.scheduler.Scheduler; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; +import net.minecraft.client.MinecraftClient; +import net.minecraft.util.math.BlockPos; + +import java.util.ArrayList; +import java.util.List; + +public class BeaconHighlighter { + static List pos = new ArrayList<>(); + + /** + * Initializes the beacon highlighting system. + * `BeaconHighlighter::render` is called after translucent rendering. + * `BeaconHighlighter::update` should be called every 5 ticks. + */ + public static void init() { + WorldRenderEvents.AFTER_TRANSLUCENT.register(BeaconHighlighter::render); + Scheduler.INSTANCE.scheduleCyclic(BeaconHighlighter::update, 5); + } + + /** + * Updates the position of the beacon. + * It checks in a 15 block radius on the X/Z axis, and a ~5 block radius on the Y axis. + * If a beacon is found, `pos` is updated to the beacon's position. + */ + + public static void update() { + var player = MinecraftClient.getInstance().player; + var world = MinecraftClient.getInstance().world; + pos.clear(); + if(player != null && world != null && + SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) { + for(int x = (player.getBlockPos().getX()-15); x { + RenderHelper.renderFilled( + context, + it, + new float[]{1.0f, 0.0f, 0.0f}, + 0.5f, + true + ); + }); + } +} diff --git a/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java deleted file mode 100644 index 44e86966..00000000 --- a/src/main/java/de/hysky/skyblocker/skyblock/endermanslayer/BeaconHighlighter.java +++ /dev/null @@ -1,62 +0,0 @@ -package de.hysky.skyblocker.skyblock.endermanslayer; - -import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.entity.MobGlow; -import de.hysky.skyblocker.utils.Tickable; -import de.hysky.skyblocker.utils.render.RenderHelper; -import de.hysky.skyblocker.utils.render.Renderable; -import de.hysky.skyblocker.utils.scheduler.Scheduler; -import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; -import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.client.MinecraftClient; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.nbt.NbtString; -import net.minecraft.util.math.BlockPos; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class BeaconHighlighter { - static BlockPos pos = null; - - public static void init() { - WorldRenderEvents.AFTER_TRANSLUCENT.register(BeaconHighlighter::render); - Scheduler.INSTANCE.scheduleCyclic(BeaconHighlighter::update, 20); - } - - public static void update() { - Logger logger = LoggerFactory.getLogger(BeaconHighlighter.class); - - var player = MinecraftClient.getInstance().player; - var world = MinecraftClient.getInstance().world; - pos = null; - if(player != null && world != null && - SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) { - for(int x = (player.getBlockPos().getX()-15); x Date: Thu, 18 Jan 2024 09:21:58 -0500 Subject: improve nukekubi highlighting --- .../java/de/hysky/skyblocker/skyblock/entity/MobGlow.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index fdaa0d6c..2d0eed4e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -67,10 +67,13 @@ public class MobGlow { } // Enderman Slayer - // Nukekubi Heads - Logger logger = LoggerFactory.getLogger(MobGlow.class); - if(entity instanceof ArmorStandEntity) { + // Highlights Nukekubi Heads + if(SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads + && entity instanceof ArmorStandEntity) { + // check for items in the armor sets for (net.minecraft.item.ItemStack it : entity.getArmorItems()) { + // hacky way to check if an item is a player head w/o + // some shenanigans if(!it.toString().startsWith("1 player_head")) continue; @@ -81,6 +84,8 @@ public class MobGlow { // for the nukekubi head, compare against it to exclusively find // armorstands that are nukekubi heads if (it.getNbt().contains("SkullOwner")) { + // get the texture of the nukekubi head item itself and + // compare it var texture = it .getNbt() .getCompound("SkullOwner") @@ -88,8 +93,8 @@ public class MobGlow { .getList("textures", NbtElement.COMPOUND_TYPE) .getCompound(0) .getString("Value"); - return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads - && texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); + + return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); } } -- cgit From 932cd36d51d505396552478e184d86b4a3a2eb94 Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 09:24:13 -0500 Subject: make this not bannable --- src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java index 1815179f..0da5cc97 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -61,7 +61,7 @@ public class BeaconHighlighter { it, new float[]{1.0f, 0.0f, 0.0f}, 0.5f, - true + false ); }); } -- cgit From 8b9f2d8bed28c0e2867871d4017eb63ebb904482 Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 09:26:50 -0500 Subject: add nukekubi glow coloring --- .../hysky/skyblocker/skyblock/entity/MobGlow.java | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index 2d0eed4e..ef61271d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -123,6 +123,39 @@ public class MobGlow { }; } + // copypaste nukekubi head logic + if(entity instanceof ArmorStandEntity) { + for (net.minecraft.item.ItemStack it : entity.getArmorItems()) { + // hacky way to check if an item is a player head w/o + // some shenanigans + if(!it.toString().startsWith("1 player_head")) + continue; + + + if (it.hasNbt()) { + assert it.getNbt() != null; + // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id + // for the nukekubi head, compare against it to exclusively find + // armorstands that are nukekubi heads + if (it.getNbt().contains("SkullOwner")) { + // get the texture of the nukekubi head item itself and + // compare it + var texture = it + .getNbt() + .getCompound("SkullOwner") + .getCompound("Properties") + .getList("textures", NbtElement.COMPOUND_TYPE) + .getCompound(0) + .getString("Value"); + + if(texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=")) { + return 0x990099; + } + } + } + } + } + return 0xf57738; } } -- cgit From 1c11eadc90ab43a0fdddfac9a65fd6b8f043837c Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 09:36:35 -0500 Subject: finish up --- src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index ef61271d..f7fb7a3e 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -123,7 +123,7 @@ public class MobGlow { }; } - // copypaste nukekubi head logic + // copypaste nukekebi head logic if(entity instanceof ArmorStandEntity) { for (net.minecraft.item.ItemStack it : entity.getArmorItems()) { // hacky way to check if an item is a player head w/o @@ -138,7 +138,7 @@ public class MobGlow { // for the nukekubi head, compare against it to exclusively find // armorstands that are nukekubi heads if (it.getNbt().contains("SkullOwner")) { - // get the texture of the nukekubi head item itself and + // get the texture of the nukekebi head item itself and // compare it var texture = it .getNbt() -- cgit From ffb7d6a489934ee8429146c451a54f5d7627bf64 Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 12:02:57 -0500 Subject: please work --- .../skyblocker/skyblock/end/BeaconHighlighter.java | 49 +++++----------------- 1 file changed, 10 insertions(+), 39 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java index 0da5cc97..98929e7c 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -1,52 +1,24 @@ package de.hysky.skyblocker.skyblock.end; import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; -import de.hysky.skyblocker.utils.scheduler.Scheduler; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; -import net.minecraft.client.MinecraftClient; import net.minecraft.util.math.BlockPos; import java.util.ArrayList; import java.util.List; public class BeaconHighlighter { - static List pos = new ArrayList<>(); + public static List positions = new ArrayList<>(); /** * Initializes the beacon highlighting system. * `BeaconHighlighter::render` is called after translucent rendering. - * `BeaconHighlighter::update` should be called every 5 ticks. */ public static void init() { WorldRenderEvents.AFTER_TRANSLUCENT.register(BeaconHighlighter::render); - Scheduler.INSTANCE.scheduleCyclic(BeaconHighlighter::update, 5); - } - - /** - * Updates the position of the beacon. - * It checks in a 15 block radius on the X/Z axis, and a ~5 block radius on the Y axis. - * If a beacon is found, `pos` is updated to the beacon's position. - */ - - public static void update() { - var player = MinecraftClient.getInstance().player; - var world = MinecraftClient.getInstance().world; - pos.clear(); - if(player != null && world != null && - SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) { - for(int x = (player.getBlockPos().getX()-15); x { - RenderHelper.renderFilled( - context, - it, - new float[]{1.0f, 0.0f, 0.0f}, - 0.5f, - false - ); - }); + if(Utils.isInTheEnd() && SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) + positions.forEach((it) -> RenderHelper.renderFilled( + context, + it, + new float[]{1.0f, 0.0f, 0.0f}, + 0.5f, + false + )); } } -- cgit From 954ccdb5ef1c0cbe658bfae43edd9cf832854ead Mon Sep 17 00:00:00 2001 From: akarahdev Date: Thu, 18 Jan 2024 15:27:27 -0500 Subject: refactor variable names --- .../skyblocker/skyblock/end/BeaconHighlighter.java | 6 +++--- .../hysky/skyblocker/skyblock/entity/MobGlow.java | 24 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java index 98929e7c..667318a4 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -11,7 +11,7 @@ import java.util.ArrayList; import java.util.List; public class BeaconHighlighter { - public static List positions = new ArrayList<>(); + public static List beaconPositions = new ArrayList<>(); /** * Initializes the beacon highlighting system. @@ -28,9 +28,9 @@ public class BeaconHighlighter { */ public static void render(WorldRenderContext context) { if(Utils.isInTheEnd() && SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) - positions.forEach((it) -> RenderHelper.renderFilled( + beaconPositions.forEach((position) -> RenderHelper.renderFilled( context, - it, + position, new float[]{1.0f, 0.0f, 0.0f}, 0.5f, false diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index f7fb7a3e..4f789f7b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -71,22 +71,22 @@ public class MobGlow { if(SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads && entity instanceof ArmorStandEntity) { // check for items in the armor sets - for (net.minecraft.item.ItemStack it : entity.getArmorItems()) { + for (net.minecraft.item.ItemStack armorItem : entity.getArmorItems()) { // hacky way to check if an item is a player head w/o // some shenanigans - if(!it.toString().startsWith("1 player_head")) + if(!armorItem.toString().startsWith("1 player_head")) continue; - if (it.hasNbt()) { - assert it.getNbt() != null; + if (armorItem.hasNbt()) { + assert armorItem.getNbt() != null; // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id // for the nukekubi head, compare against it to exclusively find // armorstands that are nukekubi heads - if (it.getNbt().contains("SkullOwner")) { + if (armorItem.getNbt().contains("SkullOwner")) { // get the texture of the nukekubi head item itself and // compare it - var texture = it + var texture = armorItem .getNbt() .getCompound("SkullOwner") .getCompound("Properties") @@ -125,22 +125,22 @@ public class MobGlow { // copypaste nukekebi head logic if(entity instanceof ArmorStandEntity) { - for (net.minecraft.item.ItemStack it : entity.getArmorItems()) { + for (net.minecraft.item.ItemStack armorItem : entity.getArmorItems()) { // hacky way to check if an item is a player head w/o // some shenanigans - if(!it.toString().startsWith("1 player_head")) + if(!armorItem.toString().startsWith("1 player_head")) continue; - if (it.hasNbt()) { - assert it.getNbt() != null; + if (armorItem.hasNbt()) { + assert armorItem.getNbt() != null; // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id // for the nukekubi head, compare against it to exclusively find // armorstands that are nukekubi heads - if (it.getNbt().contains("SkullOwner")) { + if (armorItem.getNbt().contains("SkullOwner")) { // get the texture of the nukekebi head item itself and // compare it - var texture = it + var texture = armorItem .getNbt() .getCompound("SkullOwner") .getCompound("Properties") -- cgit From b00506f518135dd4d062a311908e4506390513db Mon Sep 17 00:00:00 2001 From: akarahdev Date: Sat, 20 Jan 2024 15:40:32 -0500 Subject: again! --- .../skyblocker/skyblock/end/BeaconHighlighter.java | 13 +- .../hysky/skyblocker/skyblock/entity/MobGlow.java | 245 ++++++++++----------- 2 files changed, 118 insertions(+), 140 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java index 667318a4..65e9e639 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -24,16 +24,17 @@ public class BeaconHighlighter { /** * Renders the beacon glow around it. It is rendered in a red color with 50% opacity, and * is visible through walls. + * * @param context An instance of WorldRenderContext for the RenderHelper to use */ public static void render(WorldRenderContext context) { - if(Utils.isInTheEnd() && SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) + if (Utils.isInTheEnd() && SkyblockerConfigManager.get().slayer.endermanSlayer.highlightBeacons) beaconPositions.forEach((position) -> RenderHelper.renderFilled( - context, - position, - new float[]{1.0f, 0.0f, 0.0f}, - 0.5f, - false + context, + position, + new float[]{1.0f, 0.0f, 0.0f}, + 0.5f, + false )); } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index 4f789f7b..65ed9c03 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -13,6 +13,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.decoration.ArmorStandEntity; import net.minecraft.entity.passive.BatEntity; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtElement; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.util.Formatting; @@ -23,139 +24,115 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MobGlow { - public static boolean shouldMobGlow(Entity entity) { - Box box = entity.getBoundingBox(); - - if (!entity.isInvisible() && OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { - String name = entity.getName().getString(); - - // Dungeons - if (Utils.isInDungeons()) { - - // Minibosses - if (entity instanceof PlayerEntity) { - switch (name) { - case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); - } - } - - // Regular Mobs - if (!(entity instanceof ArmorStandEntity)) { - List armorStands = getArmorStands(entity.getWorld(), box); - - if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - } - - // Bats - return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; - } - - // Rift - if (Utils.isInTheRift()) { - if (entity instanceof PlayerEntity) { - switch (name) { - // They have a space in their name for some reason... - case "Blobbercyst ": return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; - } - } - } - - - - } - - // Enderman Slayer - // Highlights Nukekubi Heads - if(SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads - && entity instanceof ArmorStandEntity) { - // check for items in the armor sets - for (net.minecraft.item.ItemStack armorItem : entity.getArmorItems()) { - // hacky way to check if an item is a player head w/o - // some shenanigans - if(!armorItem.toString().startsWith("1 player_head")) - continue; - - - if (armorItem.hasNbt()) { - assert armorItem.getNbt() != null; - // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id - // for the nukekubi head, compare against it to exclusively find - // armorstands that are nukekubi heads - if (armorItem.getNbt().contains("SkullOwner")) { - // get the texture of the nukekubi head item itself and - // compare it - var texture = armorItem - .getNbt() - .getCompound("SkullOwner") - .getCompound("Properties") - .getList("textures", NbtElement.COMPOUND_TYPE) - .getCompound(0) - .getString("Value"); - - return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); - - } - } - } - } - - return false; - } - - private static List getArmorStands(World world, Box box) { + public static boolean shouldMobGlow(Entity entity) { + Box box = entity.getBoundingBox(); + + if (!entity.isInvisible() && OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { + String name = entity.getName().getString(); + + // Dungeons + if (Utils.isInDungeons()) { + + // Minibosses + if (entity instanceof PlayerEntity) { + switch (name) { + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": + return LividColor.shouldGlow(name); + } + } + + // Regular Mobs + if (!(entity instanceof ArmorStandEntity)) { + List armorStands = getArmorStands(entity.getWorld(), box); + + if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + } + + // Bats + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; + } + + // Rift + if (Utils.isInTheRift()) { + if (entity instanceof PlayerEntity) { + switch (name) { + // They have a space in their name for some reason... + case "Blobbercyst ": + return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; + } + } + } + + + } + + // Enderman Slayer + // Highlights Nukekubi Heads + return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads + && entity instanceof ArmorStandEntity + && isNukekubiHead((ArmorStandEntity) entity); + } + + private static boolean isNukekubiHead(ArmorStandEntity entity) { + for (ItemStack armorItem : entity.getArmorItems()) { + // hacky way to check if an item is a player head w/o + // some shenanigans + if (!armorItem.toString().startsWith("1 player_head")) + continue; + + if (armorItem.hasNbt()) { + assert armorItem.getNbt() != null; + // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id + // for the nukekubi head, compare against it to exclusively find + // armorstands that are nukekubi heads + if (armorItem.getNbt().contains("SkullOwner")) { + // get the texture of the nukekubi head item itself and + // compare it + var texture = armorItem + .getNbt() + .getCompound("SkullOwner") + .getCompound("Properties") + .getList("textures", NbtElement.COMPOUND_TYPE) + .getCompound(0) + .getString("Value"); + + return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); + + } + } + } + return false; + } + + private static List getArmorStands(World world, Box box) { return world.getEntitiesByClass(ArmorStandEntity.class, box.expand(0, 2, 0), EntityPredicates.NOT_MOUNTED); - } - - public static int getGlowColor(Entity entity) { - String name = entity.getName().getString(); - - if (entity instanceof PlayerEntity) { - return switch (name) { - case "Lost Adventurer" -> 0xfee15c; - case "Shadow Assassin" -> 0x5b2cb2; - case "Diamond Guy" -> 0x57c2f7; - case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> LividColor.getGlowColor(name); - case "Blobbercyst " -> Formatting.GREEN.getColorValue(); - default -> 0xf57738; - }; - } - - // copypaste nukekebi head logic - if(entity instanceof ArmorStandEntity) { - for (net.minecraft.item.ItemStack armorItem : entity.getArmorItems()) { - // hacky way to check if an item is a player head w/o - // some shenanigans - if(!armorItem.toString().startsWith("1 player_head")) - continue; - - - if (armorItem.hasNbt()) { - assert armorItem.getNbt() != null; - // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id - // for the nukekubi head, compare against it to exclusively find - // armorstands that are nukekubi heads - if (armorItem.getNbt().contains("SkullOwner")) { - // get the texture of the nukekebi head item itself and - // compare it - var texture = armorItem - .getNbt() - .getCompound("SkullOwner") - .getCompound("Properties") - .getList("textures", NbtElement.COMPOUND_TYPE) - .getCompound(0) - .getString("Value"); - - if(texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0=")) { - return 0x990099; - } - } - } - } - } - - return 0xf57738; - } + } + + public static int getGlowColor(Entity entity) { + String name = entity.getName().getString(); + + if (entity instanceof PlayerEntity) { + return switch (name) { + case "Lost Adventurer" -> 0xfee15c; + case "Shadow Assassin" -> 0x5b2cb2; + case "Diamond Guy" -> 0x57c2f7; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> + LividColor.getGlowColor(name); + case "Blobbercyst " -> Formatting.GREEN.getColorValue(); + default -> 0xf57738; + }; + } + + // copypaste nukekebi head logic + if (entity instanceof ArmorStandEntity && isNukekubiHead((ArmorStandEntity) entity)) { + return 0x990099; + } + + return 0xf57738; + } } -- cgit From 77f8cb5c7db674ddb066bf92f84c530e543dbc3e Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:43:25 -0500 Subject: guh --- .../skyblocker/skyblock/end/BeaconHighlighter.java | 4 +- .../hysky/skyblocker/skyblock/entity/MobGlow.java | 227 ++++++++++----------- 2 files changed, 110 insertions(+), 121 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java index 65e9e639..d2269482 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java @@ -11,11 +11,11 @@ import java.util.ArrayList; import java.util.List; public class BeaconHighlighter { - public static List beaconPositions = new ArrayList<>(); + public static final List beaconPositions = new ArrayList<>(); /** * Initializes the beacon highlighting system. - * `BeaconHighlighter::render` is called after translucent rendering. + * {@link BeaconHighlighter#render(WorldRenderContext)} is called after translucent rendering. */ public static void init() { WorldRenderEvents.AFTER_TRANSLUCENT.register(BeaconHighlighter::render); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index 65ed9c03..75744097 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -1,12 +1,7 @@ package de.hysky.skyblocker.skyblock.entity; -import java.util.List; - -import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.dungeon.LividColor; -import de.hysky.skyblocker.skyblock.itemlist.SkyblockCraftingRecipe; -import de.hysky.skyblocker.utils.Constants; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.culling.OcclusionCulling; import net.minecraft.entity.Entity; @@ -19,120 +14,114 @@ import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.util.Formatting; import net.minecraft.util.math.Box; import net.minecraft.world.World; -import org.apache.logging.log4j.LogManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; + +import java.util.List; public class MobGlow { - public static boolean shouldMobGlow(Entity entity) { - Box box = entity.getBoundingBox(); - - if (!entity.isInvisible() && OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { - String name = entity.getName().getString(); - - // Dungeons - if (Utils.isInDungeons()) { - - // Minibosses - if (entity instanceof PlayerEntity) { - switch (name) { - case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": - return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": - return LividColor.shouldGlow(name); - } - } - - // Regular Mobs - if (!(entity instanceof ArmorStandEntity)) { - List armorStands = getArmorStands(entity.getWorld(), box); - - if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) - return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - } - - // Bats - return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; - } - - // Rift - if (Utils.isInTheRift()) { - if (entity instanceof PlayerEntity) { - switch (name) { - // They have a space in their name for some reason... - case "Blobbercyst ": - return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; - } - } - } - - - } - - // Enderman Slayer - // Highlights Nukekubi Heads - return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads - && entity instanceof ArmorStandEntity - && isNukekubiHead((ArmorStandEntity) entity); - } - - private static boolean isNukekubiHead(ArmorStandEntity entity) { - for (ItemStack armorItem : entity.getArmorItems()) { - // hacky way to check if an item is a player head w/o - // some shenanigans - if (!armorItem.toString().startsWith("1 player_head")) - continue; - - if (armorItem.hasNbt()) { - assert armorItem.getNbt() != null; - // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id - // for the nukekubi head, compare against it to exclusively find - // armorstands that are nukekubi heads - if (armorItem.getNbt().contains("SkullOwner")) { - // get the texture of the nukekubi head item itself and - // compare it - var texture = armorItem - .getNbt() - .getCompound("SkullOwner") - .getCompound("Properties") - .getList("textures", NbtElement.COMPOUND_TYPE) - .getCompound(0) - .getString("Value"); - - return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); - - } - } - } - return false; - } - - private static List getArmorStands(World world, Box box) { - return world.getEntitiesByClass(ArmorStandEntity.class, box.expand(0, 2, 0), EntityPredicates.NOT_MOUNTED); - } - - public static int getGlowColor(Entity entity) { - String name = entity.getName().getString(); - - if (entity instanceof PlayerEntity) { - return switch (name) { - case "Lost Adventurer" -> 0xfee15c; - case "Shadow Assassin" -> 0x5b2cb2; - case "Diamond Guy" -> 0x57c2f7; - case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> - LividColor.getGlowColor(name); - case "Blobbercyst " -> Formatting.GREEN.getColorValue(); - default -> 0xf57738; - }; - } - - // copypaste nukekebi head logic - if (entity instanceof ArmorStandEntity && isNukekubiHead((ArmorStandEntity) entity)) { - return 0x990099; - } - - return 0xf57738; - } + public static boolean shouldMobGlow(Entity entity) { + Box box = entity.getBoundingBox(); + + if (!entity.isInvisible() && OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { + String name = entity.getName().getString(); + + // Dungeons + if (Utils.isInDungeons()) { + + // Minibosses + if (entity instanceof PlayerEntity) { + switch (name) { + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); + } + } + + // Regular Mobs + if (!(entity instanceof ArmorStandEntity)) { + List armorStands = getArmorStands(entity.getWorld(), box); + + if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + } + + // Bats + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; + } + + // Rift + if (Utils.isInTheRift()) { + if (entity instanceof PlayerEntity) { + switch (name) { + // They have a space in their name for some reason... + case "Blobbercyst ": return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; + } + } + } + + + } + + // Enderman Slayer + // Highlights Nukekubi Heads + return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads + && entity instanceof ArmorStandEntity + && isNukekubiHead((ArmorStandEntity) entity); + } + + private static boolean isNukekubiHead(ArmorStandEntity entity) { + for (ItemStack armorItem : entity.getArmorItems()) { + // hacky way to check if an item is a player head w/o + // some shenanigans + if (!armorItem.toString().startsWith("1 player_head")) + continue; + + if (armorItem.hasNbt()) { + assert armorItem.getNbt() != null; + // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id + // for the nukekubi head, compare against it to exclusively find + // armorstands that are nukekubi heads + if (armorItem.getNbt().contains("SkullOwner")) { + // get the texture of the nukekubi head item itself and + // compare it + var texture = armorItem + .getNbt() + .getCompound("SkullOwner") + .getCompound("Properties") + .getList("textures", NbtElement.COMPOUND_TYPE) + .getCompound(0) + .getString("Value"); + + return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); + + } + } + } + return false; + } + + private static List getArmorStands(World world, Box box) { + return world.getEntitiesByClass(ArmorStandEntity.class, box.expand(0, 2, 0), EntityPredicates.NOT_MOUNTED); + } + + public static int getGlowColor(Entity entity) { + String name = entity.getName().getString(); + + if (entity instanceof PlayerEntity) { + return switch (name) { + case "Lost Adventurer" -> 0xfee15c; + case "Shadow Assassin" -> 0x5b2cb2; + case "Diamond Guy" -> 0x57c2f7; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid" -> LividColor.getGlowColor(name); + case "Blobbercyst " -> Formatting.GREEN.getColorValue(); + default -> 0xf57738; + }; + } + + // copypaste nukekebi head logic + if (entity instanceof ArmorStandEntity && isNukekubiHead((ArmorStandEntity) entity)) { + return 0x990099; + } + + return 0xf57738; + } } -- cgit From 5f781ecb8e3546a60f5745710e79c0ee922fb8c1 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Sun, 21 Jan 2024 12:58:38 -0500 Subject: Refactor MobGlow --- .../hysky/skyblocker/skyblock/entity/MobGlow.java | 122 ++++++++++----------- 1 file changed, 59 insertions(+), 63 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index 75744097..a831ddab 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -9,6 +9,7 @@ import net.minecraft.entity.decoration.ArmorStandEntity; import net.minecraft.entity.passive.BatEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.util.Formatting; @@ -21,80 +22,53 @@ public class MobGlow { public static boolean shouldMobGlow(Entity entity) { Box box = entity.getBoundingBox(); - if (!entity.isInvisible() && OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { + if (OcclusionCulling.getReducedCuller().isVisible(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ)) { String name = entity.getName().getString(); - // Dungeons - if (Utils.isInDungeons()) { + if (!entity.isInvisible()) { - // Minibosses - if (entity instanceof PlayerEntity) { - switch (name) { - case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", - "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); + // Dungeons + if (Utils.isInDungeons()) { + + // Minibosses + if (entity instanceof PlayerEntity) { + switch (name) { + case "Lost Adventurer", "Shadow Assassin", "Diamond Guy": return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + case "Arcade Livid", "Crossed Livid", "Doctor Livid", "Frog Livid", "Hockey Livid", + "Purple Livid", "Scream Livid", "Smile Livid", "Vendetta Livid": return LividColor.shouldGlow(name); + } } - } - // Regular Mobs - if (!(entity instanceof ArmorStandEntity)) { - List armorStands = getArmorStands(entity.getWorld(), box); + // Regular Mobs + if (!(entity instanceof ArmorStandEntity)) { + List armorStands = getArmorStands(entity.getWorld(), box); - if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; - } + if (!armorStands.isEmpty() && armorStands.get(0).getName().getString().contains("✯")) + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow; + } - // Bats - return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; - } + // Bats + return SkyblockerConfigManager.get().locations.dungeons.starredMobGlow && entity instanceof BatEntity; + } - // Rift - if (Utils.isInTheRift()) { - if (entity instanceof PlayerEntity) { - switch (name) { - // They have a space in their name for some reason... - case "Blobbercyst ": return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; + // Rift + if (Utils.isInTheRift()) { + if (entity instanceof PlayerEntity) { + switch (name) { + // They have a space in their name for some reason... + case "Blobbercyst ": return SkyblockerConfigManager.get().locations.rift.blobbercystGlow; + } } } } - + // Enderman Slayer + // Highlights Nukekubi Heads + return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads + && entity instanceof ArmorStandEntity armorStandEntity + && isNukekubiHead(armorStandEntity); } - // Enderman Slayer - // Highlights Nukekubi Heads - return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads - && entity instanceof ArmorStandEntity - && isNukekubiHead((ArmorStandEntity) entity); - } - - private static boolean isNukekubiHead(ArmorStandEntity entity) { - for (ItemStack armorItem : entity.getArmorItems()) { - // hacky way to check if an item is a player head w/o - // some shenanigans - if (!armorItem.toString().startsWith("1 player_head")) - continue; - - if (armorItem.hasNbt()) { - assert armorItem.getNbt() != null; - // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id - // for the nukekubi head, compare against it to exclusively find - // armorstands that are nukekubi heads - if (armorItem.getNbt().contains("SkullOwner")) { - // get the texture of the nukekubi head item itself and - // compare it - var texture = armorItem - .getNbt() - .getCompound("SkullOwner") - .getCompound("Properties") - .getList("textures", NbtElement.COMPOUND_TYPE) - .getCompound(0) - .getString("Value"); - - return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); - - } - } - } return false; } @@ -118,10 +92,32 @@ public class MobGlow { } // copypaste nukekebi head logic - if (entity instanceof ArmorStandEntity && isNukekubiHead((ArmorStandEntity) entity)) { - return 0x990099; - } + if (entity instanceof ArmorStandEntity armorStandEntity && isNukekubiHead(armorStandEntity)) return 0x990099; return 0xf57738; } + + private static boolean isNukekubiHead(ArmorStandEntity entity) { + for (ItemStack armorItem : entity.getArmorItems()) { + // hacky way to check if an item is a player head w/o + // some shenanigans + if (!armorItem.toString().startsWith("1 player_head")) + continue; + + // eb07594e2df273921a77c101d0bfdfa1115abed5b9b2029eb496ceba9bdbb4b3 is texture id for the nukekubi head, + // compare against it to exclusively find armorstands that are nukekubi heads + NbtCompound skullOwner = armorItem.getSubNbt("SkullOwner"); + if (skullOwner != null) { + // get the texture of the nukekubi head item itself and compare it + String texture = skullOwner + .getCompound("Properties") + .getList("textures", NbtElement.COMPOUND_TYPE) + .getCompound(0) + .getString("Value"); + + return texture.contains("eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZWIwNzU5NGUyZGYyNzM5MjFhNzdjMTAxZDBiZmRmYTExMTVhYmVkNWI5YjIwMjllYjQ5NmNlYmE5YmRiYjRiMyJ9fX0="); + } + } + return false; + } } -- cgit From b0c70044006f40542487209954d59349fe12e9e7 Mon Sep 17 00:00:00 2001 From: akarahdev Date: Tue, 23 Jan 2024 16:30:18 -0500 Subject: add extra check --- src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/main/java/de/hysky/skyblocker/skyblock') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java index a831ddab..d0d58606 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/entity/MobGlow.java @@ -2,6 +2,7 @@ package de.hysky.skyblocker.skyblock.entity; import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.dungeon.LividColor; +import de.hysky.skyblocker.utils.SlayerUtils; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.culling.OcclusionCulling; import net.minecraft.entity.Entity; @@ -65,6 +66,7 @@ public class MobGlow { // Enderman Slayer // Highlights Nukekubi Heads return SkyblockerConfigManager.get().slayer.endermanSlayer.highlightNukekubiHeads + && SlayerUtils.isInSlayer() && entity instanceof ArmorStandEntity armorStandEntity && isNukekubiHead(armorStandEntity); } -- cgit