diff options
author | Julienraptor01 <julienraptor01@gmail.com> | 2023-07-29 04:06:35 +0200 |
---|---|---|
committer | Julienraptor01 <julienraptor01@gmail.com> | 2023-07-29 04:06:35 +0200 |
commit | eee776d2702dd619aaec2180fb878b94a856369c (patch) | |
tree | 4e0c3ad16dcfcfe72f23d2ec9984000dd6ce9a5e /src/main/java/me/xmrvizzy | |
parent | e2f6339a09982d9fa882f0c41b607815b5e14806 (diff) | |
download | Skyblocker-eee776d2702dd619aaec2180fb878b94a856369c.tar.gz Skyblocker-eee776d2702dd619aaec2180fb878b94a856369c.tar.bz2 Skyblocker-eee776d2702dd619aaec2180fb878b94a856369c.zip |
Yay
Diffstat (limited to 'src/main/java/me/xmrvizzy')
4 files changed, 105 insertions, 56 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java index 50c60840..bd414acb 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java +++ b/src/main/java/me/xmrvizzy/skyblocker/SkyblockerMod.java @@ -87,7 +87,7 @@ public class SkyblockerMod implements ClientModInitializer { TheRift.init(); TitleContainer.init(); OcclusionCulling.init(); - EtherwarpOverlay.init(); + TeleportOverlay.init(); containerSolverManager.init(); scheduler.scheduleCyclic(Utils::update, 20); scheduler.scheduleCyclic(DiscordRPCManager::updateDataAndPresence, 100); diff --git a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java index 6874f2ce..2cc7dd36 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/me/xmrvizzy/skyblocker/config/SkyblockerConfig.java @@ -136,7 +136,6 @@ public class SkyblockerConfig implements ConfigData { public boolean acceptReparty = true; public boolean backpackPreviewWithoutShift = false; public boolean hideEmptyTooltips = true; - public boolean etherwarpOverlay = true; @ConfigEntry.Category("tabHud") @ConfigEntry.Gui.CollapsibleObject() @@ -182,6 +181,10 @@ public class SkyblockerConfig implements ConfigData { @ConfigEntry.Gui.CollapsibleObject() public TitleContainer titleContainer = new TitleContainer(); + @ConfigEntry.Category("Teleport Overlay") + @ConfigEntry.Gui.CollapsibleObject() + public TeleportOverlay teleportOverlay = new TeleportOverlay(); + @ConfigEntry.Gui.Excluded public List<Integer> lockedSlots = new ArrayList<>(); } @@ -293,6 +296,15 @@ public class SkyblockerConfig implements ConfigData { public Alignment alignment = Alignment.MIDDLE; } + public static class TeleportOverlay { + public boolean enableTeleportOverlays = true; + public boolean enableWeirdTransmission = true; + public boolean enableInstantTransmission = true; + public boolean enableEtherTransmission = true; + public boolean enableSinrecallTransmission = true; + public boolean enableWitherImpact = true; + } + public enum Direction { HORIZONTAL, VERTICAL; diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/EtherwarpOverlay.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/EtherwarpOverlay.java deleted file mode 100644 index 005b3d64..00000000 --- a/src/main/java/me/xmrvizzy/skyblocker/skyblock/EtherwarpOverlay.java +++ /dev/null @@ -1,54 +0,0 @@ -package me.xmrvizzy.skyblocker.skyblock; - -import com.mojang.blaze3d.systems.RenderSystem; - -import me.xmrvizzy.skyblocker.config.SkyblockerConfig; -import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; -import me.xmrvizzy.skyblocker.utils.RenderHelper; -import me.xmrvizzy.skyblocker.utils.Utils; -import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; -import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.client.MinecraftClient; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NbtCompound; -import net.minecraft.util.hit.BlockHitResult; -import net.minecraft.util.hit.HitResult; -import net.minecraft.util.math.BlockPos; - -public class EtherwarpOverlay { - private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); - private static final float[] COLOR_COMPONENTS = { 118f / 255f, 21f / 255f, 148f / 255f }; - - public static void init() { - WorldRenderEvents.AFTER_TRANSLUCENT.register(EtherwarpOverlay::renderEtherwarpOverlay); - } - - private static void renderEtherwarpOverlay(WorldRenderContext wrc) { - if (Utils.isOnSkyblock() && SkyblockerConfig.get().general.etherwarpOverlay) { - ItemStack heldItem = CLIENT.player.getMainHandStack(); - String itemId = PriceInfoTooltip.getInternalNameFromNBT(heldItem); - NbtCompound nbt = heldItem.getNbt(); - - if (itemId != null && (((itemId.equals("ASPECT_OF_THE_VOID") || itemId.equals("ASPECT_OF_THE_END")) && nbt.getCompound("ExtraAttributes").getInt("ethermerge") == 1 && CLIENT.options.sneakKey.isPressed()) || itemId.equals("ETHERWARP_CONDUIT"))) { - int range = (nbt.getCompound("ExtraAttributes").contains("tuned_transmission")) ? 57 + nbt.getCompound("ExtraAttributes").getInt("tuned_transmission") : 57; - HitResult result = CLIENT.player.raycast(range, wrc.tickDelta(), false); - - if (result instanceof BlockHitResult blockHit) { - BlockPos pos = blockHit.getBlockPos(); - BlockState state = CLIENT.world.getBlockState(pos); - if (state.getBlock() != Blocks.AIR && CLIENT.world.getBlockState(pos.up()).getBlock() == Blocks.AIR && CLIENT.world.getBlockState(pos.up(2)).getBlock() == Blocks.AIR) { - RenderSystem.polygonOffset(-1f, -10f); - RenderSystem.enablePolygonOffset(); - - RenderHelper.renderFilledIfVisible(wrc, pos, COLOR_COMPONENTS, 0.5f); - - RenderSystem.polygonOffset(0f, 0f); - RenderSystem.disablePolygonOffset(); - } - } - } - } - } -} diff --git a/src/main/java/me/xmrvizzy/skyblocker/skyblock/TeleportOverlay.java b/src/main/java/me/xmrvizzy/skyblocker/skyblock/TeleportOverlay.java new file mode 100644 index 00000000..6551ac9d --- /dev/null +++ b/src/main/java/me/xmrvizzy/skyblocker/skyblock/TeleportOverlay.java @@ -0,0 +1,91 @@ +package me.xmrvizzy.skyblocker.skyblock; + +import com.mojang.blaze3d.systems.RenderSystem; + +import me.xmrvizzy.skyblocker.config.SkyblockerConfig; +import me.xmrvizzy.skyblocker.skyblock.item.PriceInfoTooltip; +import me.xmrvizzy.skyblocker.utils.RenderHelper; +import me.xmrvizzy.skyblocker.utils.Utils; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.hit.HitResult; +import net.minecraft.util.math.BlockPos; + +public class TeleportOverlay { + private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); + private static final float[] COLOR_COMPONENTS = { 118f / 255f, 21f / 255f, 148f / 255f }; + + public static void init() { + WorldRenderEvents.AFTER_TRANSLUCENT.register(TeleportOverlay::define); + } + + private static void define(WorldRenderContext wrc) { + if (Utils.isOnSkyblock() && SkyblockerConfig.get().general.teleportOverlay.enableTeleportOverlays) { + ItemStack heldItem = CLIENT.player.getMainHandStack(); + String itemId = PriceInfoTooltip.getInternalNameFromNBT(heldItem); + NbtCompound nbt = heldItem.getNbt(); + + if (itemId != null) { + switch (itemId) { + case "ASPECT_OF_THE_LEECH_1" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableWeirdTransmission) { + render(wrc, 3); + } + } + case "ASPECT_OF_THE_LEECH_2" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableWeirdTransmission) { + render(wrc, 4); + } + } + case "ASPECT_OF_THE_END", "ASPECT_OF_THE_VOID" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableEtherTransmission && nbt.getCompound("ExtraAttributes").getInt("ethermerge") == 1 && CLIENT.options.sneakKey.isPressed()) { + render(wrc, (nbt.getCompound("ExtraAttributes").contains("tuned_transmission")) ? 57 + nbt.getCompound("ExtraAttributes").getInt("tuned_transmission") : 57); + } + else if (SkyblockerConfig.get().general.teleportOverlay.enableInstantTransmission) { + render(wrc, (nbt.getCompound("ExtraAttributes").contains("tuned_transmission")) ? 8 + nbt.getCompound("ExtraAttributes").getInt("tuned_transmission") : 8); + } + } + case "ETHERWARP_CONDUIT" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableEtherTransmission) { + render(wrc, (nbt.getCompound("ExtraAttributes").contains("tuned_transmission")) ? 57 + nbt.getCompound("ExtraAttributes").getInt("tuned_transmission") : 57); + } + } + case "SINSEEKER_SCYTHE" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableSinrecallTransmission) { + render(wrc, (nbt.getCompound("ExtraAttributes").contains("tuned_transmission")) ? 4 + nbt.getCompound("ExtraAttributes").getInt("tuned_transmission") : 4); + } + } + case "NECRON_BLADE", "ASTRAEA", "HYPERION", "SCYLLA", "VALKYRIE" -> { + if (SkyblockerConfig.get().general.teleportOverlay.enableWitherImpact) { + render(wrc, 10); + } + } + } + } + } + } + + private static void render(WorldRenderContext wrc, double range) { + HitResult result = CLIENT.player.raycast(range, wrc.tickDelta(), false); + + if (result instanceof BlockHitResult blockHit) { + BlockPos pos = blockHit.getBlockPos(); + BlockState state = CLIENT.world.getBlockState(pos); + if (state.getBlock() != Blocks.AIR && CLIENT.world.getBlockState(pos.up()).getBlock() == Blocks.AIR && CLIENT.world.getBlockState(pos.up(2)).getBlock() == Blocks.AIR) { + RenderSystem.polygonOffset(-1f, -10f); + RenderSystem.enablePolygonOffset(); + + RenderHelper.renderFilledIfVisible(wrc, pos, COLOR_COMPONENTS, 0.5f); + + RenderSystem.polygonOffset(0f, 0f); + RenderSystem.disablePolygonOffset(); + } + } + } +} |