diff --git a/gradle.properties b/gradle.properties index 5908d70..7c8d4ee 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ mod_name = VanillaHUD mod_id = vanillahud -mod_version = 2.2.5 +mod_version = 2.2.6 mod_archives_name=VanillaHUD # Gradle Configuration -- DO NOT TOUCH THESE VALUES. diff --git a/src/dummy/java/at/hannibal2/skyhanni/SkyHanniMod.java b/src/dummy/java/at/hannibal2/skyhanni/SkyHanniMod.java new file mode 100644 index 0000000..c8c3b98 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/SkyHanniMod.java @@ -0,0 +1,10 @@ +package at.hannibal2.skyhanni; + +import at.hannibal2.skyhanni.config.Features; + +public class SkyHanniMod { + public static Features feature = new Features(); + public static Features getFeature() { + return feature; + } +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/config/Features.java b/src/dummy/java/at/hannibal2/skyhanni/config/Features.java new file mode 100644 index 0000000..b3474db --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/config/Features.java @@ -0,0 +1,7 @@ +package at.hannibal2.skyhanni.config; + +import at.hannibal2.skyhanni.config.features.gui.GUIConfig; + +public class Features { + public GUIConfig gui = new GUIConfig(); +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java b/src/dummy/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java new file mode 100644 index 0000000..4bd4857 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/config/features/gui/GUIConfig.java @@ -0,0 +1,7 @@ +package at.hannibal2.skyhanni.config.features.gui; + +import at.hannibal2.skyhanni.config.features.misc.compacttablist.CompactTabListConfig; + +public class GUIConfig { + public CompactTabListConfig compactTabList = new CompactTabListConfig(); +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java b/src/dummy/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java new file mode 100644 index 0000000..6563fc6 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java @@ -0,0 +1,7 @@ +package at.hannibal2.skyhanni.config.features.misc.compacttablist; + +import at.hannibal2.skyhanni.deps.moulconfig.observer.Property; + +public class CompactTabListConfig { + public Property enabled = Property.of(false); +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/GetSetter.java b/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/GetSetter.java new file mode 100644 index 0000000..dcb4ae2 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/GetSetter.java @@ -0,0 +1,18 @@ +package at.hannibal2.skyhanni.deps.moulconfig.observer; + +import java.util.function.Consumer; +import java.util.function.Supplier; + +public interface GetSetter + extends Supplier, + Consumer { + @Override + public T get(); + + public void set(T var1); + + @Override + default public void accept(T t) { + this.set(t); + } +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/Property.java b/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/Property.java new file mode 100644 index 0000000..20ad27e --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/deps/moulconfig/observer/Property.java @@ -0,0 +1,20 @@ +package at.hannibal2.skyhanni.deps.moulconfig.observer; + +public abstract class Property + implements GetSetter { + public static Property of(T value) { + return new Property() { + private T value; + + @Override + public T get() { + return this.value; + } + + @Override + public void set(T value) { + this.value = value; + } + }; + } +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/RenderColumn.java b/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/RenderColumn.java new file mode 100644 index 0000000..d9337a4 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/RenderColumn.java @@ -0,0 +1,4 @@ +package at.hannibal2.skyhanni.features.misc.compacttablist; + +public class RenderColumn { +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.java b/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.java new file mode 100644 index 0000000..66c28ac --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListReader.java @@ -0,0 +1,12 @@ +package at.hannibal2.skyhanni.features.misc.compacttablist; + +import java.util.ArrayList; +import java.util.List; + +public class TabListReader { + public static final TabListReader INSTANCE = new TabListReader(); + + public final List getRenderColumns() { + return new ArrayList<>(); + } +} diff --git a/src/dummy/java/at/hannibal2/skyhanni/utils/LorenzUtils.java b/src/dummy/java/at/hannibal2/skyhanni/utils/LorenzUtils.java new file mode 100644 index 0000000..1acfda9 --- /dev/null +++ b/src/dummy/java/at/hannibal2/skyhanni/utils/LorenzUtils.java @@ -0,0 +1,9 @@ +package at.hannibal2.skyhanni.utils; + +public class LorenzUtils { + public static final LorenzUtils INSTANCE = new LorenzUtils(); + + public final boolean getInSkyBlock() { + return true; + } +} diff --git a/src/main/java/org/polyfrost/vanillahud/VanillaHUD.java b/src/main/java/org/polyfrost/vanillahud/VanillaHUD.java index d766c1a..0440634 100644 --- a/src/main/java/org/polyfrost/vanillahud/VanillaHUD.java +++ b/src/main/java/org/polyfrost/vanillahud/VanillaHUD.java @@ -1,6 +1,9 @@ package org.polyfrost.vanillahud; import Apec.Components.Gui.GuiIngame.ApecGuiIngameForge; +import at.hannibal2.skyhanni.SkyHanniMod; +import at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader; +import at.hannibal2.skyhanni.utils.LorenzUtils; import cc.polyfrost.oneconfig.events.EventManager; import cc.polyfrost.oneconfig.utils.Notifications; import club.sk1er.patcher.config.OldPatcherConfig; @@ -10,7 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.Loader; import org.polyfrost.vanillahud.config.ModConfig; -import org.polyfrost.vanillahud.hud.TabList; +import org.polyfrost.vanillahud.hud.*; import org.polyfrost.vanillahud.utils.TabListManager; @net.minecraftforge.fml.common.Mod(modid = VanillaHUD.MODID, name = VanillaHUD.NAME, version = VanillaHUD.VERSION) @@ -24,6 +27,8 @@ public class VanillaHUD { public static boolean isPatcher = false; public static boolean isHytils = false; private static boolean isSBA = false; + private static boolean isSkyHanni = false; + private static boolean skyHanniField = false; @net.minecraftforge.fml.common.Mod.EventHandler public void onFMLInitialization(net.minecraftforge.fml.common.event.FMLInitializationEvent event) { @@ -45,6 +50,94 @@ public void onPostInit(net.minecraftforge.fml.common.event.FMLPostInitialization isPatcher = Loader.isModLoaded("patcher"); isHytils = Loader.isModLoaded("hytils-reborn"); isSBA = Loader.isModLoaded("skyblockaddons") || Loader.isModLoaded("sbaunofficial"); + isSkyHanni = Loader.isModLoaded("skyhanni"); + if (isSkyHanni) { + try { + // make sure the classes are loaded + Class.forName("at.hannibal2.skyhanni.config.features.gui.GUIConfig", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.config.features.misc.compacttablist.CompactTabListConfig", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.config.Features", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.deps.moulconfig.observer.Property", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.deps.moulconfig.observer.GetSetter", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.features.misc.compacttablist.RenderColumn", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.features.misc.compacttablist.TabListReader", false, getClass().getClassLoader()); + Class.forName("at.hannibal2.skyhanni.utils.LorenzUtils", false, getClass().getClassLoader()); + Class clazz = Class.forName("at.hannibal2.skyhanni.SkyHanniMod", true, getClass().getClassLoader()); + try { + clazz.getDeclaredField("feature"); + skyHanniField = true; + } catch (NoSuchFieldException e) { + skyHanniField = false; + } + } catch (ClassNotFoundException e) { + isSkyHanni = false; + } + } + + if (!ModConfig.doneDebugMigration) { + if (!ModConfig.actionBar.hud.showInDebug) { + ModConfig.actionBar.hud.showInDebug = true; + ModConfig.actionBar.save(); + } + if (!Air.hud.showInDebug) { + ModConfig.air.hud.showInDebug = true; + ModConfig.air.save(); + } + if (!Armor.hud.showInDebug) { + ModConfig.armor.hud.showInDebug = true; + ModConfig.armor.save(); + } + if (!BossBar.hud.showInDebug) { + BossBar.hud.showInDebug = true; + ModConfig.bossBar.save(); + } + if (!Experience.hud.showInDebug) { + Experience.hud.showInDebug = true; + ModConfig.experience.save(); + } + if (!Health.hud.showInDebug) { + Health.hud.showInDebug = true; + ModConfig.health.save(); + } + if (!Hotbar.hud.showInDebug) { + Hotbar.hud.showInDebug = true; + ModConfig.hotBar.save(); + } + if (!Hunger.hud.showInDebug) { + Hunger.hud.showInDebug = true; + ModConfig.hunger.save(); + } + if (!Hunger.mountHud.showInDebug) { + Hunger.mountHud.showInDebug = true; + ModConfig.hunger.save(); + } + if (!ModConfig.itemTooltip.hud.showInDebug) { + ModConfig.itemTooltip.hud.showInDebug = true; + ModConfig.itemTooltip.save(); + } + if (!ModConfig.scoreboard.hud.showInDebug) { + ModConfig.scoreboard.hud.showInDebug = true; + ModConfig.scoreboard.save(); + } + if (!TabList.hud.showInDebug) { + TabList.hud.showInDebug = true; + ModConfig.tab.save(); + } + if (TabList.TabHud.selfAtTop) { + TabList.TabHud.selfAtTop = false; + ModConfig.tab.save(); + } + if (!ModConfig.title.titleHUD.showInDebug) { + ModConfig.title.titleHUD.showInDebug = true; + ModConfig.title.save(); + } + if (!ModConfig.title.subtitleHUD.showInDebug) { + ModConfig.title.subtitleHUD.showInDebug = true; + ModConfig.title.save(); + } + ModConfig.doneDebugMigration = true; + modConfig.save(); + } if (!TabList.TabHud.updatedHeight) { TabList.TabHud.updatedHeight = true; @@ -131,7 +224,8 @@ public static boolean isApec() { return apec && Minecraft.getMinecraft().ingameGUI instanceof ApecGuiIngameForge; } - public static boolean isSBATab() { - return isSBA && SkyblockAddons.getInstance().getUtils().isOnSkyblock() && SkyblockAddons.getInstance().getConfigValues().isEnabled(Feature.COMPACT_TAB_LIST) && TabListParser.getRenderColumns() != null; + public static boolean isCompactTab() { + return (isSBA && SkyblockAddons.getInstance().getUtils().isOnSkyblock() && SkyblockAddons.getInstance().getConfigValues().isEnabled(Feature.COMPACT_TAB_LIST) && TabListParser.getRenderColumns() != null) + || (isSkyHanni && LorenzUtils.INSTANCE.getInSkyBlock() && (skyHanniField ? SkyHanniMod.feature.gui.compactTabList.enabled.get() : SkyHanniMod.getFeature().gui.compactTabList.enabled.get()) && TabListReader.INSTANCE.getRenderColumns() != null); } } diff --git a/src/main/java/org/polyfrost/vanillahud/config/ModConfig.java b/src/main/java/org/polyfrost/vanillahud/config/ModConfig.java index 0aadc42..a298e98 100644 --- a/src/main/java/org/polyfrost/vanillahud/config/ModConfig.java +++ b/src/main/java/org/polyfrost/vanillahud/config/ModConfig.java @@ -40,5 +40,6 @@ public ModConfig() { @SubConfig public static Title title = new Title(); public static boolean hasMigratedPatcher = false; + public static boolean doneDebugMigration = false; } \ No newline at end of file diff --git a/src/main/java/org/polyfrost/vanillahud/hud/ActionBar.java b/src/main/java/org/polyfrost/vanillahud/hud/ActionBar.java index 396fff5..12d9d27 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/ActionBar.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/ActionBar.java @@ -44,6 +44,7 @@ public static class ActionBarHUD extends SingleTextHud { public ActionBarHUD() { super("", true, 1920f / 2, 1080f - 62f, 1, false, false, 0, 0, 0, new OneColor(0, 0, 0, 80), false, 2, new OneColor(0, 0, 0)); EventManager.INSTANCE.register(this); + showInDebug = true; } @Override diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Air.java b/src/main/java/org/polyfrost/vanillahud/hud/Air.java index 4c16fef..b346b18 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Air.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Air.java @@ -25,6 +25,7 @@ public static class AirHud extends HudBar { public AirHud() { super(true, 1920 / 2f + 182 / 2f - 81, 1080 - 49, true); + showInDebug = true; } } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Armor.java b/src/main/java/org/polyfrost/vanillahud/hud/Armor.java index 3ddf69d..7bdb13c 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Armor.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Armor.java @@ -26,6 +26,7 @@ public static class ArmorHud extends HudBar { public ArmorHud() { super(true, 1920 / 2f - 182 / 2f, 1080 - 49, false); + showInDebug = true; } } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/BossBar.java b/src/main/java/org/polyfrost/vanillahud/hud/BossBar.java index 1eedfb2..c087e1a 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/BossBar.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/BossBar.java @@ -72,6 +72,7 @@ public static class BossBarHUD extends SingleTextHud { public BossBarHUD() { super("", true, 1920f / 2, 2f, 1, false, false, 0, 0, 0, new OneColor(0, 0, 0, 120), false, 2, new OneColor(0, 0, 0)); this.textType = 1; + showInDebug = true; EventManager.INSTANCE.register(this); } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Experience.java b/src/main/java/org/polyfrost/vanillahud/hud/Experience.java index 87f20b3..f0192b6 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Experience.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Experience.java @@ -22,6 +22,7 @@ public static class ExperienceHud extends Hud { public ExperienceHud() { super(true, 1920 / 2f - 182 / 2f, 1080 - 29); + showInDebug = true; } @Slider( diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Health.java b/src/main/java/org/polyfrost/vanillahud/hud/Health.java index 4daba65..85b90f7 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Health.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Health.java @@ -39,6 +39,7 @@ public static class HealthHud extends HudBar { public HealthHud() { super(true, 1920 / 2f - 182 / 2f, 1080 - 39, false); + showInDebug = true; } } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Hotbar.java b/src/main/java/org/polyfrost/vanillahud/hud/Hotbar.java index 9512917..1f6032e 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Hotbar.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Hotbar.java @@ -25,6 +25,7 @@ public static class HotBarHud extends Hud { public HotBarHud() { super(true, 1920 / 2f - 182 / 2f, 1080 - 22f); + showInDebug = true; } @Exclude diff --git a/src/main/java/org/polyfrost/vanillahud/hud/HudBar.java b/src/main/java/org/polyfrost/vanillahud/hud/HudBar.java index 81de736..d0ba349 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/HudBar.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/HudBar.java @@ -8,6 +8,7 @@ public class HudBar extends Hud { public HudBar(boolean enable, float x, float y, boolean alignment) { super(enable, x, y); + showInDebug = true; this.alignment = alignment; } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Hunger.java b/src/main/java/org/polyfrost/vanillahud/hud/Hunger.java index d755ec0..7e8db8b 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Hunger.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Hunger.java @@ -53,6 +53,7 @@ public static class HungerHud extends HudBar { public HungerHud() { super(true, 1920 / 2f + 182 / 2f - 81, 1080 - 39, true); + showInDebug = true; } } @@ -63,6 +64,7 @@ public static class MountHud extends HudBar { public MountHud() { super(false, 1920 / 2f + 182 / 2f - 81, 1080 - 59, true); + showInDebug = true; } } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/ItemTooltip.java b/src/main/java/org/polyfrost/vanillahud/hud/ItemTooltip.java index a084212..9240219 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/ItemTooltip.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/ItemTooltip.java @@ -50,6 +50,7 @@ public static class HeldItemTooltipHUD extends SingleTextHud { public HeldItemTooltipHUD() { super("", true, 1920f / 2, 1080f - 37f, 1, false, false, 0, 0, 0, new OneColor(0, 0, 0, 80), false, 2, new OneColor(0, 0, 0)); this.textType = 1; + showInDebug = true; EventManager.INSTANCE.register(this); } diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Scoreboard.java b/src/main/java/org/polyfrost/vanillahud/hud/Scoreboard.java index 4eb659e..aa171da 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Scoreboard.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Scoreboard.java @@ -82,6 +82,7 @@ public static class ScoreboardHUD extends BasicHud { public ScoreboardHUD() { super(true, 1919, 1080f / 2f, 1, true, false, 0, 1, 0, new OneColor(0, 0, 0, 80), false, 2, new OneColor(0, 0, 0)); EventManager.INSTANCE.register(this); + showInDebug = true; } @Override diff --git a/src/main/java/org/polyfrost/vanillahud/hud/TabList.java b/src/main/java/org/polyfrost/vanillahud/hud/TabList.java index bf66d49..165dfca 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/TabList.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/TabList.java @@ -49,6 +49,7 @@ public static class TabHud extends BasicHud { public TabHud() { super(true, 1920 / 2f, 10); // the default y is actually 20, see VanillaHUD main class ignoreCaching = true; + showInDebug = true; } @Switch( diff --git a/src/main/java/org/polyfrost/vanillahud/hud/Title.java b/src/main/java/org/polyfrost/vanillahud/hud/Title.java index ca4e136..26d49f1 100644 --- a/src/main/java/org/polyfrost/vanillahud/hud/Title.java +++ b/src/main/java/org/polyfrost/vanillahud/hud/Title.java @@ -44,6 +44,7 @@ public TitleHUD() { public TitleHUD(float x, float y, float scale) { super("", true, x, y, scale, false, false, 2, 2, 2, new OneColor(0, 0, 0, 80), false, 2, new OneColor(0, 0, 0)); this.textType = 1; + showInDebug = true; } @Override diff --git a/src/main/java/org/polyfrost/vanillahud/mixin/EntityRendererMixin.java b/src/main/java/org/polyfrost/vanillahud/mixin/EntityRendererMixin.java index 4590a77..abf653b 100644 --- a/src/main/java/org/polyfrost/vanillahud/mixin/EntityRendererMixin.java +++ b/src/main/java/org/polyfrost/vanillahud/mixin/EntityRendererMixin.java @@ -14,7 +14,7 @@ public class EntityRendererMixin { @Inject(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiIngame;renderGameOverlay(F)V", shift = At.Shift.AFTER)) private void draw(float partialTicks, long nanoTime, CallbackInfo ci) { - if (VanillaHUD.isSBATab()) { + if (VanillaHUD.isCompactTab()) { return; } TabList.isGuiIngame = false; diff --git a/src/main/java/org/polyfrost/vanillahud/mixin/GuiIngameForgeMixin.java b/src/main/java/org/polyfrost/vanillahud/mixin/GuiIngameForgeMixin.java index 0d7e6ef..8218028 100644 --- a/src/main/java/org/polyfrost/vanillahud/mixin/GuiIngameForgeMixin.java +++ b/src/main/java/org/polyfrost/vanillahud/mixin/GuiIngameForgeMixin.java @@ -520,7 +520,7 @@ private void setCheck(float partialTicks, CallbackInfo ci) { @Redirect(method = "renderPlayerList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/settings/KeyBinding;isKeyDown()Z")) private boolean tabExample(KeyBinding instance) { - if (VanillaHUD.isSBATab() || !ModConfig.tab.enabled) { + if (VanillaHUD.isCompactTab() || !ModConfig.tab.enabled) { return instance.isKeyDown(); } ScoreObjective scoreobjective = mc.theWorld.getScoreboard().getObjectiveInDisplaySlot(0); @@ -554,7 +554,7 @@ private boolean tabExample2(Minecraft instance) { @Inject(method = "renderPlayerList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V")) private void enableScissor(int width, int height, CallbackInfo ci) { - if (HudCore.editing || VanillaHUD.isSBATab()) return; + if (HudCore.editing || VanillaHUD.isCompactTab()) return; GL11.glEnable(GL11.GL_SCISSOR_TEST); Position position = TabList.hud.position; int scale = (int) UResolution.getScaleFactor(); @@ -563,7 +563,7 @@ private void enableScissor(int width, int height, CallbackInfo ci) { @Inject(method = "renderPlayerList", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;renderPlayerlist(ILnet/minecraft/scoreboard/Scoreboard;Lnet/minecraft/scoreboard/ScoreObjective;)V", shift = At.Shift.AFTER)) private void disable(int width, int height, CallbackInfo ci) { - if (HudCore.editing || VanillaHUD.isSBATab()) return; + if (HudCore.editing || VanillaHUD.isCompactTab()) return; GL11.glDisable(GL11.GL_SCISSOR_TEST); } diff --git a/src/main/java/org/polyfrost/vanillahud/mixin/GuiPlayerTabOverlayMixin.java b/src/main/java/org/polyfrost/vanillahud/mixin/GuiPlayerTabOverlayMixin.java index d8398d2..3cfddf3 100644 --- a/src/main/java/org/polyfrost/vanillahud/mixin/GuiPlayerTabOverlayMixin.java +++ b/src/main/java/org/polyfrost/vanillahud/mixin/GuiPlayerTabOverlayMixin.java @@ -53,7 +53,7 @@ public abstract class GuiPlayerTabOverlayMixin { @ModifyVariable(method = "renderPlayerlist", at = @At(value = "STORE", ordinal = 0), ordinal = 9) private int resetY(int y) { - if (VanillaHUD.isSBATab()) return y; + if (VanillaHUD.isCompactTab()) return y; return 1; } @@ -71,7 +71,7 @@ private int captureEntryX(int x) { @ModifyConstant(method = "renderPlayerlist", constant = @Constant(intValue = 13)) private int pingWidth(int constant) { - if (VanillaHUD.isSBATab()) return constant; + if (VanillaHUD.isCompactTab()) return constant; int width = 3; if (TabList.TabHud.numberPing && TabList.TabHud.pingType) { int maxWidth = 0; @@ -88,7 +88,7 @@ private int pingWidth(int constant) { @Redirect(method = "renderPlayerlist", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;header:Lnet/minecraft/util/IChatComponent;")) private IChatComponent modifyHeader(GuiPlayerTabOverlay instance) { - if (VanillaHUD.isSBATab()) return header; + if (VanillaHUD.isCompactTab()) return header; if (!TabList.TabHud.showHeader) return null; if (HudCore.editing) return tab$exampleHeader; return header; @@ -96,7 +96,7 @@ private IChatComponent modifyHeader(GuiPlayerTabOverlay instance) { @Redirect(method = "renderPlayerlist", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;footer:Lnet/minecraft/util/IChatComponent;")) private IChatComponent modifyFooter(GuiPlayerTabOverlay instance) { - if (VanillaHUD.isSBATab()) return footer; + if (VanillaHUD.isCompactTab()) return footer; if (!TabList.TabHud.showFooter) return null; if (HudCore.editing) return tab$exampleFooter; return footer; @@ -113,7 +113,7 @@ private void translate(int width, Scoreboard scoreboardIn, ScoreObjective scoreO ci.cancel(); return; } - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; TabList.TabHud hud = TabList.hud; GlStateManager.pushMatrix(); GlStateManager.translate((float) (-width / 2) * hud.getScale() + hud.position.getCenterX(), hud.position.getY() + hud.getPaddingY(), 0); @@ -125,13 +125,13 @@ private void translate(int width, Scoreboard scoreboardIn, ScoreObjective scoreO @Inject(method = "renderPlayerlist", at = @At(value = "TAIL")) private void pop(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn, CallbackInfo ci) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; GlStateManager.popMatrix(); } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lcom/google/common/collect/Ordering;sortedCopy(Ljava/lang/Iterable;)Ljava/util/List;")) private List list(Ordering instance, Iterable elements) { - if (VanillaHUD.isSBATab()) return instance.sortedCopy(elements); + if (VanillaHUD.isCompactTab()) return instance.sortedCopy(elements); List list = instance.sortedCopy(elements); if (TabList.TabHud.selfAtTop) { for (NetworkPlayerInfo info : list) { @@ -147,31 +147,31 @@ private List list(Ordering instance, Itera @ModifyArgs(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawRect(IIIII)V", ordinal = 0)) private void cancelRect(Args args) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; args.set(4, tab$TRANSPARENT); } @ModifyArgs(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawRect(IIIII)V", ordinal = 1)) private void cancelRect1(Args args) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; args.set(4, tab$TRANSPARENT); } @ModifyArgs(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawRect(IIIII)V", ordinal = 3)) private void cancelRect2(Args args) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; args.set(4, tab$TRANSPARENT); } @ModifyArgs(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawRect(IIIII)V", ordinal = 2)) private void fixWidth(Args args) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; args.set(2, (int) args.get(2) - 1); } @ModifyConstant(method = "renderPlayerlist", constant = @Constant(intValue = 20, ordinal = 0)) private int limit(int constant) { - if (VanillaHUD.isSBATab()) return constant; + if (VanillaHUD.isCompactTab()) return constant; return (HudCore.editing ? 10 : constant); } @@ -182,14 +182,14 @@ private int limit(int constant) { to = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawPing(IIILnet/minecraft/client/network/NetworkPlayerInfo;)V") )) private void preHeadTransform(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn, CallbackInfo ci) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; GlStateManager.pushMatrix(); GlStateManager.translate(TabList.TabHud.showHead ? 0 : -8, 0, 0); } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I")) private int drawText(FontRenderer instance, String text, float x, float y, int color) { - if (VanillaHUD.isSBATab()) return instance.drawStringWithShadow(text, x, y, color); + if (VanillaHUD.isCompactTab()) return instance.drawStringWithShadow(text, x, y, color); GlStateManager.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.enableAlpha(); @@ -208,20 +208,20 @@ private int drawText(FontRenderer instance, String text, float x, float y, int c to = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawPing(IIILnet/minecraft/client/network/NetworkPlayerInfo;)V") )) private void postHeadTransform(int width, Scoreboard scoreboardIn, ScoreObjective scoreObjectiveIn, CallbackInfo ci) { - if (VanillaHUD.isSBATab()) return; + if (VanillaHUD.isCompactTab()) return; GlStateManager.popMatrix(); } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;drawScaledCustomSizeModalRect(IIFFIIIIFF)V", ordinal = 0)) private void playerHead(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) { - if (!TabList.TabHud.showHead && !VanillaHUD.isSBATab()) return; + if (!TabList.TabHud.showHead && !VanillaHUD.isCompactTab()) return; Gui.drawScaledCustomSizeModalRect(x, y, u, v, uWidth, vHeight, width, height, tileWidth, tileHeight); } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;drawScaledCustomSizeModalRect(IIFFIIIIFF)V", ordinal = 1)) private void playerHead1(int x, int y, float u, float v, int uWidth, int vHeight, int width, int height, float tileWidth, float tileHeight) { - if (!TabList.TabHud.showHead && !VanillaHUD.isSBATab()) return; + if (!TabList.TabHud.showHead && !VanillaHUD.isCompactTab()) return; if (TabList.TabHud.betterHatLayer) { GlStateManager.translate(-0.5f, -0.5f, 0f); Gui.drawScaledCustomSizeModalRect(x, y, u, v, uWidth, vHeight, 9, 9, tileWidth, tileHeight); @@ -253,7 +253,7 @@ private void scoreboard(GuiPlayerTabOverlay instance, ScoreObjective scoreObject @Redirect(method = "drawScoreboardValues", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;drawStringWithShadow(Ljava/lang/String;FFI)I", ordinal = 1)) private int translate(FontRenderer instance, String text, float x, float y, int color) { - if (VanillaHUD.isSBATab()) return instance.drawStringWithShadow(text, x, y, color); + if (VanillaHUD.isCompactTab()) return instance.drawStringWithShadow(text, x, y, color); int ping = info.getResponseTime(); boolean offset = TabList.TabHud.numberPing && TabList.TabHud.hideFalsePing && (ping <= 1 || ping >= 999) || !TabList.TabHud.showPing; float textWidth = mc.fontRendererObj.getStringWidth(text); @@ -264,7 +264,7 @@ private int translate(FontRenderer instance, String text, float x, float y, int @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiPlayerTabOverlay;drawPing(IIILnet/minecraft/client/network/NetworkPlayerInfo;)V")) private void redirectDrawPing(GuiPlayerTabOverlay instance, int width, int x, int y, NetworkPlayerInfo networkPlayerInfoIn) { - if (VanillaHUD.isSBATab()) { + if (VanillaHUD.isCompactTab()) { ((GuiPlayerTabOverlayAccessor) instance).renderPing(width, x, y, networkPlayerInfoIn); return; } @@ -305,25 +305,25 @@ private void redirectDrawPing(GuiPlayerTabOverlay instance, int width, int x, in @ModifyConstant(method = "renderPlayerlist", constant = @Constant(intValue = 553648127)) private int tabOpacity(int opacity) { - if (VanillaHUD.isSBATab()) return opacity; + if (VanillaHUD.isCompactTab()) return opacity; return TabList.TabHud.tabWidgetColor.getRGB(); } @ModifyConstant(method = "renderPlayerlist", constant = @Constant(intValue = 80)) private int changePlayerCount(int original) { - if (VanillaHUD.isSBATab()) return original; + if (VanillaHUD.isCompactTab()) return original; return TabList.TabHud.getTabPlayerLimit(); } @ModifyVariable(method = "renderPlayerlist", at = @At(value = "STORE"), ordinal = 0) private List setLimit(List value) { - currentList = VanillaHUD.isSBATab() ? value : value.subList(0, Math.min(value.size(), TabList.TabHud.getTabPlayerLimit())); + currentList = VanillaHUD.isCompactTab() ? value : value.subList(0, Math.min(value.size(), TabList.TabHud.getTabPlayerLimit())); return currentList; } @Redirect(method = "renderPlayerlist", at = @At(value = "INVOKE", target = "Ljava/lang/Math;min(II)I", ordinal = 1)) private int noLimit(int a, int b) { - if (VanillaHUD.isSBATab() || !TabList.TabHud.fixWidth) return Math.min(a, b); + if (VanillaHUD.isCompactTab() || !TabList.TabHud.fixWidth) return Math.min(a, b); return a; } diff --git a/src/main/resources/vanillahud_dark.svg b/src/main/resources/vanillahud_dark.svg index 5bfb9c6..1572a23 100644 --- a/src/main/resources/vanillahud_dark.svg +++ b/src/main/resources/vanillahud_dark.svg @@ -1,5 +1,7 @@ - - - + + + + +