Skip to content

Commit

Permalink
show in debug by default, skyhanni compat, fix icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Wyvest committed Jun 24, 2024
1 parent 1ab9f84 commit c73f97b
Show file tree
Hide file tree
Showing 29 changed files with 239 additions and 34 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 10 additions & 0 deletions src/dummy/java/at/hannibal2/skyhanni/SkyHanniMod.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
7 changes: 7 additions & 0 deletions src/dummy/java/at/hannibal2/skyhanni/config/Features.java
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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();
}
Original file line number Diff line number Diff line change
@@ -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<Boolean> enabled = Property.of(false);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package at.hannibal2.skyhanni.deps.moulconfig.observer;

import java.util.function.Consumer;
import java.util.function.Supplier;

public interface GetSetter<T>
extends Supplier<T>,
Consumer<T> {
@Override
public T get();

public void set(T var1);

@Override
default public void accept(T t) {
this.set(t);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package at.hannibal2.skyhanni.deps.moulconfig.observer;

public abstract class Property<T>
implements GetSetter<T> {
public static <T> Property<T> of(T value) {
return new Property<T>() {
private T value;

@Override
public T get() {
return this.value;
}

@Override
public void set(T value) {
this.value = value;
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package at.hannibal2.skyhanni.features.misc.compacttablist;

public class RenderColumn {
}
Original file line number Diff line number Diff line change
@@ -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<RenderColumn> getRenderColumns() {
return new ArrayList<>();
}
}
9 changes: 9 additions & 0 deletions src/dummy/java/at/hannibal2/skyhanni/utils/LorenzUtils.java
Original file line number Diff line number Diff line change
@@ -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;
}
}
100 changes: 97 additions & 3 deletions src/main/java/org/polyfrost/vanillahud/VanillaHUD.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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)
Expand All @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,6 @@ public ModConfig() {
@SubConfig
public static Title title = new Title();
public static boolean hasMigratedPatcher = false;
public static boolean doneDebugMigration = false;

}
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/ActionBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Air.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class AirHud extends HudBar {

public AirHud() {
super(true, 1920 / 2f + 182 / 2f - 81, 1080 - 49, true);
showInDebug = true;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Armor.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public static class ArmorHud extends HudBar {

public ArmorHud() {
super(true, 1920 / 2f - 182 / 2f, 1080 - 49, false);
showInDebug = true;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/BossBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Experience.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public static class ExperienceHud extends Hud {

public ExperienceHud() {
super(true, 1920 / 2f - 182 / 2f, 1080 - 29);
showInDebug = true;
}

@Slider(
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Health.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static class HealthHud extends HudBar {

public HealthHud() {
super(true, 1920 / 2f - 182 / 2f, 1080 - 39, false);
showInDebug = true;
}
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Hotbar.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class HotBarHud extends Hud {

public HotBarHud() {
super(true, 1920 / 2f - 182 / 2f, 1080 - 22f);
showInDebug = true;
}

@Exclude
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/HudBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Hunger.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static class HungerHud extends HudBar {

public HungerHud() {
super(true, 1920 / 2f + 182 / 2f - 81, 1080 - 39, true);
showInDebug = true;
}
}

Expand All @@ -63,6 +64,7 @@ public static class MountHud extends HudBar {

public MountHud() {
super(false, 1920 / 2f + 182 / 2f - 81, 1080 - 59, true);
showInDebug = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Scoreboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/TabList.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/polyfrost/vanillahud/hud/Title.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit c73f97b

Please sign in to comment.