diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2024-01-21 12:43:25 -0500 |
---|---|---|
committer | akarahdev <endisticbutitsforgit@gmail.com> | 2024-01-22 20:31:22 -0500 |
commit | 77f8cb5c7db674ddb066bf92f84c530e543dbc3e (patch) | |
tree | 01a5904de95bb3aecc308d9c9b190d0629b2951b /src/main/java/de/hysky/skyblocker | |
parent | b5b11b31e2d9ed911c6a740e15160982bcd1f71f (diff) | |
download | Skyblocker-77f8cb5c7db674ddb066bf92f84c530e543dbc3e.tar.gz Skyblocker-77f8cb5c7db674ddb066bf92f84c530e543dbc3e.tar.bz2 Skyblocker-77f8cb5c7db674ddb066bf92f84c530e543dbc3e.zip |
guh
Diffstat (limited to 'src/main/java/de/hysky/skyblocker')
5 files changed, 116 insertions, 180 deletions
diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 7d5c08d8..62e5ed90 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -156,16 +156,11 @@ public class SkyblockerConfig { @SerialEntry public boolean acceptReparty = true; -<<<<<<< HEAD @SerialEntry public boolean betterPartyFinder = true; @SerialEntry public boolean backpackPreviewWithoutShift = false; -======= - @SerialEntry - public boolean backpackPreviewWithoutShift = false; ->>>>>>> c9ef08ab (fix the indentation) @SerialEntry public boolean compactorDeletorPreview = true; @@ -538,14 +533,9 @@ public class SkyblockerConfig { public float itemRarityBackgroundsOpacity = 1f; } -<<<<<<< HEAD public enum RarityBackgroundStyle { CIRCULAR(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_circular")), SQUARE(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_square")); -======= - public enum RarityBackgroundStyle { - CIRCULAR(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_circular")), SQUARE(new Identifier(SkyblockerMod.NAMESPACE, "item_rarity_background_square")); ->>>>>>> c9ef08ab (fix the indentation) public final Identifier tex; @@ -616,16 +606,11 @@ public class SkyblockerConfig { @SerialEntry public DungeonChestProfit dungeonChestProfit = new DungeonChestProfit(); -<<<<<<< HEAD @SerialEntry public MimicMessage mimicMessage = new MimicMessage(); @SerialEntry public boolean croesusHelper = true; -======= - @SerialEntry - public boolean croesusHelper = true; ->>>>>>> c9ef08ab (fix the indentation) @SerialEntry public boolean enableMap = true; @@ -669,16 +654,11 @@ public class SkyblockerConfig { @SerialEntry public boolean floor3GuardianHealthDisplay = true; -<<<<<<< HEAD @SerialEntry public boolean allowDroppingProtectedItems = false; @SerialEntry public LividColor lividColor = new LividColor(); -======= - @SerialEntry - public LividColor lividColor = new LividColor(); ->>>>>>> c9ef08ab (fix the indentation) @SerialEntry public Terminals terminals = new Terminals(); @@ -741,15 +721,10 @@ public class SkyblockerConfig { @SerialEntry public Type doorHighlightType = Type.OUTLINED_HIGHLIGHT; -<<<<<<< HEAD public enum Type { HIGHLIGHT, OUTLINED_HIGHLIGHT, OUTLINE; -======= - public enum Type { - HIGHLIGHT, OUTLINED_HIGHLIGHT, OUTLINE; ->>>>>>> c9ef08ab (fix the indentation) @Override public String toString() { @@ -784,7 +759,6 @@ public class SkyblockerConfig { @SerialEntry public boolean enableDungeonScore300Sound = true; -<<<<<<< HEAD @SerialEntry public String dungeonScore300Message = "300 Score Reached!"; @@ -800,11 +774,6 @@ public class SkyblockerConfig { @SerialEntry public float scoreScaling = 1f; } -======= - @SerialEntry - public String dungeonScore300Message = "300 Score Reached!"; - } ->>>>>>> c9ef08ab (fix the indentation) public static class DungeonChestProfit { @SerialEntry @@ -832,7 +801,6 @@ public class SkyblockerConfig { public Formatting incompleteColor = Formatting.BLUE; } -<<<<<<< HEAD public static class MimicMessage { @SerialEntry public boolean sendMimicMessage = true; @@ -844,11 +812,6 @@ public class SkyblockerConfig { public static class LividColor { @SerialEntry public boolean enableLividColorGlow = true; -======= - public static class LividColor { - @SerialEntry - public boolean enableLividColorGlow = true; ->>>>>>> c9ef08ab (fix the indentation) @SerialEntry public boolean enableLividColorText = true; @@ -953,16 +916,6 @@ public class SkyblockerConfig { public boolean highlightFoundRelics = true; } -<<<<<<< HEAD - public static class Slayer { - @SerialEntry - public VampireSlayer vampireSlayer = new VampireSlayer(); - } - - public static class VampireSlayer { - @SerialEntry - public boolean enableEffigyWaypoints = true; -======= public static class Slayer { @SerialEntry public EndermanSlayer endermanSlayer = new EndermanSlayer(); @@ -982,7 +935,6 @@ public class SkyblockerConfig { public static class VampireSlayer { @SerialEntry public boolean enableEffigyWaypoints = true; ->>>>>>> c9ef08ab (fix the indentation) @SerialEntry public boolean compactEffigyWaypoints; @@ -1052,7 +1004,6 @@ public class SkyblockerConfig { @SerialEntry public ChatFilterResult hideToggleSkyMall = ChatFilterResult.PASS; -<<<<<<< HEAD @SerialEntry public ChatFilterResult hideMimicKill = ChatFilterResult.PASS; @@ -1062,11 +1013,6 @@ public class SkyblockerConfig { @SerialEntry public boolean hideMana = false; } -======= - @SerialEntry - public boolean hideMana = false; - } ->>>>>>> c9ef08ab (fix the indentation) public enum Info { PURSE, BITS, LOCATION; diff --git a/src/main/java/de/hysky/skyblocker/config/categories/SlayersCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/SlayersCategory.java index 15e6f4a6..19b30937 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/SlayersCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/SlayersCategory.java @@ -16,6 +16,8 @@ public class SlayersCategory { public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig config) { return ConfigCategory.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.category.slayer")) + + //Enderman Slayer .group(OptionGroup.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.slayer.endermanSlayer")) .collapsed(true) diff --git a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java index 738c2165..e1a28262 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java @@ -3,7 +3,6 @@ package de.hysky.skyblocker.mixin; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import com.llamalad7.mixinextras.injector.WrapWithCondition; import com.llamalad7.mixinextras.sugar.Local; -import de.hysky.skyblocker.config.SkyblockerConfig; import de.hysky.skyblocker.skyblock.FishingHelper; import de.hysky.skyblocker.skyblock.dungeon.DungeonScore; import de.hysky.skyblocker.skyblock.dungeon.secrets.DungeonManager; @@ -11,6 +10,7 @@ import de.hysky.skyblocker.skyblock.end.BeaconHighlighter; import de.hysky.skyblocker.skyblock.waypoint.MythologicalRitual; import de.hysky.skyblocker.utils.SlayerUtils; import de.hysky.skyblocker.utils.Utils; +import net.minecraft.block.Blocks; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.entity.Entity; @@ -37,7 +37,7 @@ public abstract class ClientPlayNetworkHandlerMixin { FishingHelper.onSound(packet); } - @ModifyVariable(method = "onItemPickupAnimation", at = @At(value = "STORE", ordinal = 0)) + @ModifyVariable(method = "onItemPickupAnimation", at = @At(value = "STORE", ordinal = 0)) private ItemEntity skyblocker$onItemPickup(ItemEntity itemEntity, @Local LivingEntity collector) { DungeonManager.onItemPickup(itemEntity, collector, collector == MinecraftClient.getInstance().player); return itemEntity; @@ -81,12 +81,11 @@ public abstract class ClientPlayNetworkHandlerMixin { } @Inject(method = "onBlockUpdate", at = @At("RETURN")) private void skyblocker$onBlockUpdate(BlockUpdateS2CPacket packet, CallbackInfo ci) { - if(Utils.isInTheEnd() && SlayerUtils.isInSlayer()) { + if (Utils.isInTheEnd() && SlayerUtils.isInSlayer()) { BeaconHighlighter.beaconPositions.remove(packet.getPos()); - if(packet.getState().toString().contains("minecraft:beacon")) { + if (packet.getState().isOf(Blocks.BEACON)) { BeaconHighlighter.beaconPositions.add(packet.getPos()); } } - } } 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<BlockPos> beaconPositions = new ArrayList<>(); + public static final List<BlockPos> 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<ArmorStandEntity> 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<ArmorStandEntity> 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<ArmorStandEntity> 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<ArmorStandEntity> 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; + } } |