Skip to content

Commit 3d9804c

Browse files
authored
5.0.0 (#86)
* Locator prep * dep bump * Update gradle.properties * Update gradle.properties * It compiles yay * Fix hiding vanilla HUD bars * renderAddons, config query utility class * hasLocatorBar check and additional mob heads * Something shows on screen:tm: * Working height * Simplified locator mob head indicator * Locatability indicator * Consistently visible locator bar * Bump deps to pre3 * Advanced mob heads * Advanced raid and trial omen * Several fixes * Remove some imports * Make locator arrows show above * Update README.md * Cleanup * Fix mount jump not showing on creative * moveMigrated for Gradle * 1.21.7 * Return Mod Menu * 1.21.6+ * Fix config stuff * Move mode 1 between OneBar and hotbar * Saturation tooltip relocation and clarification * Fix XP bar * Fix F3 TPS hiding keeping OneBar up * Refactor compat mode and tooltips * Fix tooltip location * Adjust more setting names and tooltips * Fixin' da mixin * More tooltip stuff * 5.0.0
1 parent 9c690de commit 3d9804c

23 files changed

Lines changed: 560 additions & 209 deletions

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ The mod only uses client-side data, so it is never needed on a server. There are
6868
| Water Breathing, Conduit Power | Blue || -~⭘1~ | -~ai1~ | The bar is only shown if you got the effect after losing air, text is only shown if you are in water |
6969
| Held food restored hunger: exact/less | Green || _→1_ | _→1_ | Overlaid on hunger bar; number is the resulting hunger (like AppleSkin) |
7070
| Held food restored hunger: wasted | Orange || _→-1_ | _→-1_ | Overlaid on hunger bar; number is the waste of hunger (how much more than needed) |
71+
| Saturation | Orange || | Below OneBar | Opt-in |
7172

7273
#### Negative (right-to-left)
7374

@@ -87,14 +88,14 @@ The mod only uses client-side data, so it is never needed on a server. There are
8788
| Fall height (experimental) | | | -⊻1 | -fa1 | Opt-in, indicates the amount of blocks you're about to fall in-air/with levitation effect/while sneaking on an edge. Currently does not consider target block type, your effects and enchants. |
8889
| Glowing | | | -☀ | -gl | Usually given when shot by a spectral arrow. Emoji chosen to remind of the effect icon. |
8990
| Infested | | | -💔🐛 | -Hin | Having infested effect may summon silverfish upon getting hit. Given in ominous trials. |
90-
| Weaving | | | -😵🕸 | -Dwe | Having weaving effect may summon cobwebs upon death. Given in ominous trials. |
91-
| Oozing | | | -😵▪▪ | -Doo | Having oozing effect may summon two slimes upon death. Given in ominous trials. |
92-
| Wind Charged | | | -😵💨 | -Dwi | Having wind charged effect may summon a wind charge upon death. Given in ominous trials. |
9391
| Bad Omen | | | -👹?1× | -bo1× | Number is the effect level; preserved when converting into Raid or Trial Omen |
94-
| Raid Omen | | | -👹🪓1× | -ro1× | Number is [the effect level](https://minecraft.wiki/w/Raid#Java_Edition) |
95-
| Trial Omen | | | -👹🗝1× | -to1× | Number is [the duration multiplier](https://minecraft.wiki/w/Trial_Omen#Causes), e.g. level 2 means 2×15=30 minutes of ominous trial |
9692
| Impending death | | | _→0_ | _→0_ | Drowning, freezing damage, burning in fire/lava, starvation, suffocation, angry warden. Zero is the resulting health (death) |
9793
| Hardcore mode | | | -☠ | -HC | The vanilla one, not the UHC mode of OneBar which has no indicators |
94+
| Weaving | | | -😵🕸 | -Dwe | Opt-in, having weaving effect may summon cobwebs upon death. Given in ominous trials. |
95+
| Oozing | | | -😵▪▪ | -Doo | Opt-in, having oozing effect may summon two slimes upon death. Given in ominous trials. |
96+
| Wind Charged | | | -😵💨 | -Dwi | Opt-in, having wind charged effect may summon a wind charge upon death. Given in ominous trials. |
97+
| Raid Omen | | | -👹🪓1w | -ro1w | Number indicates the total amount of raid waves. |
98+
| Trial Omen | | | -👹🗝1m | -to1m | Number indicates the remaining minutes of ominous trial. |
9899

99100
#### Mounts
100101

@@ -113,7 +114,7 @@ The mod only uses client-side data, so it is never needed on a server. There are
113114
| Armor durability | Light blue || | | Overlaid on armor bar | Opt-in, width adapts to armor bar or armor bar segment |
114115
| Segmented armor | White || | | Above OneBar | Opt-in, similar to normal bar but each armor piece is a separate bar |
115116
| Elytra durability | Purple || | | Armor bar area | Normal armor bar: displayed as a full-width overlay only when flying; segmented armor bar: displayed constantly as a diamond-width bar at chest segment. |
116-
| Mob head indicator | | | +a☻ | +aH | OneBar | Opt-in, "a" represents s̲keleton, c̲reeper, z̲ombie head; e̲nderman (carved pumpkin), p̲iglin (any golden armor or piglin head) |
117+
| Mob head indicator | | | +a☻1 | +aH1 | Opt-in, "a" represents each mob's initial, except e̲nderman (carved pumpkin) and g_olden (any golden armor or piglin head) and l_ocator (all heads work overall but for player, dragon and wither skeleton head indicator is only shown when locator bar is available). Number indicates the minimum amount of blocks the player can safely stand from the mob when wearing its head (rounded, considers sneaking and invisibility).
117118

118119
#### Others
119120

@@ -122,6 +123,7 @@ The mod only uses client-side data, so it is never needed on a server. There are
122123
| Experience bar | Green || 1 | Next to hotbar | Shown only when you have any XP (configurable) |
123124
| Lapis Lazuli counter | Blue | | 1 or 1× | Next to experience bar | Opt-in, shows either the raw count or times enchantable maxed out (XP level 30+) |
124125
| Saturation | Orange || | Below OneBar | Opt-in |
126+
| Locatability indicator | | | -🔍 | -lo | Opt-in, shows when locator bar is available on the server (even if you hide it) and you are visible to others. |
125127

126128
## FAQ
127129

build.gradle

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
plugins {
2-
id 'fabric-loom' version '1.10-SNAPSHOT'
2+
id 'fabric-loom' version '1.11-SNAPSHOT'
33
id 'maven-publish'
44
}
55

6+
loom {
7+
accessWidenerPath = file("src/main/resources/ingamehudbartype.accesswidener")
8+
}
9+
610
sourceCompatibility = JavaVersion.VERSION_21
711
targetCompatibility = JavaVersion.VERSION_21
812

@@ -89,3 +93,13 @@ publishing {
8993
// retrieving dependencies.
9094
}
9195
}
96+
97+
tasks.register('moveMigrated') {
98+
group = 'migration'
99+
description = 'Moves all files from remappedSrc into src/main/java'
100+
doLast {
101+
ant.move(todir: file('src/main/java')) {
102+
fileset(dir: file('remappedSrc'))
103+
}
104+
}
105+
}

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://fabricmc.net/develop/
6-
minecraft_version=1.21.5
7-
yarn_mappings=1.21.5+build.1
8-
loader_version=0.16.13
6+
minecraft_version=1.21.7
7+
yarn_mappings=1.21.7+build.2
8+
loader_version=0.16.14
99

1010
# Mod Properties
11-
mod_version = 4.2.1
11+
mod_version = 5.0.0
1212
maven_group = io.github.madis0
1313
archives_base_name = onebar
1414

1515
# Dependencies
16-
fabric_api_version=0.119.9+1.21.5
17-
modmenu_version=14.0.0-rc.2
18-
cloth_config_version=18.0.145
16+
fabric_api_version=0.128.2+1.21.7
17+
modmenu_version=15.0.0-beta.3
18+
cloth_config_version=19.0.147
1919
exordium_version=1.2.1-1.20.2

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/io/github/madis0/ClientProperties.java

Lines changed: 41 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.github.madis0;
22

3-
import io.github.madis0.mixin.DebugHudAccessor;
43
import net.fabricmc.loader.api.FabricLoader;
54
import net.minecraft.client.MinecraftClient;
65
import net.minecraft.client.option.AttackIndicator;
@@ -37,24 +36,43 @@ public class ClientProperties {
3736
public final int mountStartH;
3837
public final int mountEndH;
3938

39+
public int locatorBarOriginalH;
40+
public int locatorBarBossBarH;
41+
public int locatorBarHeightConst;
42+
43+
public final int tooltipSurvivalH;
44+
public final int tooltipCreativeH;
45+
public final int tooltipSurvivalMountH;
46+
public final int tooltipCreativeLocatorH;
47+
public final int tooltipCreativeMountCompatH;
48+
4049
public final boolean isHardcore;
4150

4251
public ClientProperties(){
4352
MinecraftClient client = MinecraftClient.getInstance();
4453
int scaledWidth = client.getWindow().getScaledWidth();
4554
int scaledHeight = client.getWindow().getScaledHeight();
4655

56+
boolean compatMode = MixinConfigQuery.isCompatModeEnabled();
57+
boolean hasHotbarLocatorBar = MixinConfigQuery.isLocatorBarEnabled() && MixinConfigQuery.isLocatorBarMode(ModConfig.LocatorBarMode.HOTBAR);
58+
locatorBarHeightConst = 7;
59+
60+
boolean f3IsCovering = MinecraftClient.getInstance().inGameHud.getDebugHud().shouldRenderTickCharts() ||
61+
MinecraftClient.getInstance().inGameHud.getDebugHud().shouldShowPacketSizeAndPingCharts();
62+
4763
baseStartW = scaledWidth / 2 - 91;
4864
baseEndW = baseStartW + 182;
49-
baseStartH = scaledHeight - 33;
65+
baseStartH = scaledHeight - 33 - ((hasHotbarLocatorBar || compatMode) ? locatorBarHeightConst : 0);
5066

5167
if (FabricLoader.getInstance().getObjectShare().get("raised:hud") instanceof Integer distance) {
5268
baseStartH -= distance;
5369
}
5470

55-
if (((DebugHudAccessor)MinecraftClient.getInstance().inGameHud.getDebugHud()).isRenderingAndTickChartsVisible() ||
56-
MinecraftClient.getInstance().inGameHud.getDebugHud().shouldShowPacketSizeAndPingCharts()) {
57-
baseStartH -= 50;
71+
if (compatMode) {
72+
baseStartH -= 20;
73+
}
74+
else if (f3IsCovering) {
75+
baseStartH -= 42;
5876
}
5977

6078
baseEndH = baseStartH + 9;
@@ -68,18 +86,21 @@ public ClientProperties(){
6886
if (client.options.getMainArm().getValue() == Arm.RIGHT){
6987
xpStartW = baseEndW + 4;
7088
if(client.options.getAttackIndicator().getValue() == AttackIndicator.HOTBAR)
71-
xpStartW = xpStartW + 20;
89+
xpStartW += 20;
7290
}
7391
else if (client.options.getMainArm().getValue() == Arm.LEFT) {
7492
xpStartW = baseStartW - 22;
7593
if(client.options.getAttackIndicator().getValue() == AttackIndicator.HOTBAR)
76-
xpStartW = xpStartW - 20;
94+
xpStartW -= 20;
7795
}
7896

79-
if (((DebugHudAccessor)MinecraftClient.getInstance().inGameHud.getDebugHud()).isRenderingAndTickChartsVisible() ||
80-
MinecraftClient.getInstance().inGameHud.getDebugHud().shouldShowPacketSizeAndPingCharts()) {
97+
if (f3IsCovering || compatMode) {
8198
xpStartH = baseStartH + 11;
82-
} else {
99+
}
100+
else if(hasHotbarLocatorBar){
101+
xpStartH = baseStartH + 28 + locatorBarHeightConst;
102+
}
103+
else {
83104
xpStartH = baseStartH + 28;
84105
}
85106

@@ -99,6 +120,16 @@ else if (client.options.getMainArm().getValue() == Arm.LEFT) {
99120
mountStartH = baseStartH - 12;
100121
mountEndH = mountStartH + 9;
101122

123+
locatorBarOriginalH = scaledHeight - 24 - 5;
124+
locatorBarBossBarH = 12;
125+
126+
tooltipSurvivalH = baseStartH - 11;
127+
tooltipSurvivalMountH = mountStartH - 11;
128+
129+
tooltipCreativeH = (scaledHeight - 33) - 14;
130+
tooltipCreativeLocatorH = tooltipCreativeH - locatorBarHeightConst;
131+
tooltipCreativeMountCompatH = tooltipCreativeH - locatorBarHeightConst - 20;
132+
102133
isHardcore = Objects.requireNonNull(client.world).getLevelProperties().isHardcore();
103134
}
104135

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package io.github.madis0;
2+
3+
import me.shedaniel.autoconfig.AutoConfig;
4+
5+
public class MixinConfigQuery {
6+
private static final ModConfig config = AutoConfig.getConfigHolder(ModConfig.class).getConfig();
7+
8+
public static boolean isOneBarEnabled() {
9+
return config.showOneBar;
10+
}
11+
12+
public static boolean isCompatModeEnabled() {
13+
return config.compatibilityMode;
14+
}
15+
16+
public static boolean isHotbarTooltipsDown(){
17+
return config.otherBars.hotbarTooltipsDown;
18+
}
19+
20+
public static boolean showMountJump(){
21+
return config.entity.showMountJump;
22+
}
23+
24+
public static boolean isLocatorBarEnabled() {
25+
return config.otherBars.locatorBarMode != ModConfig.LocatorBarMode.DISABLED.ordinal() && PlayerProperties.locatorBarAvailable;
26+
}
27+
28+
public static boolean isLocatorBarMode(ModConfig.LocatorBarMode mode){
29+
return config.otherBars.locatorBarMode == mode.ordinal();
30+
}
31+
32+
public static int getLocatorBarHeight() {
33+
ClientProperties clientProperties = new ClientProperties();
34+
35+
// Convert the config int back to the enum, with DISABLED as a fallback:
36+
ModConfig.LocatorBarMode modeEnum;
37+
try {
38+
modeEnum = ModConfig.LocatorBarMode.values()[config.otherBars.locatorBarMode];
39+
} catch (ArrayIndexOutOfBoundsException e) {
40+
modeEnum = ModConfig.LocatorBarMode.DISABLED;
41+
}
42+
43+
return switch (modeEnum) {
44+
case HOTBAR -> clientProperties.locatorBarOriginalH;
45+
case BOSSBAR -> clientProperties.locatorBarBossBarH;
46+
default -> 0;
47+
};
48+
}
49+
50+
51+
}

src/main/java/io/github/madis0/ModConfig.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66

77
@Config(name = "onebar")
88
public class ModConfig implements ConfigData {
9+
public enum LocatorBarMode {
10+
DISABLED,
11+
HOTBAR,
12+
BOSSBAR;
13+
}
14+
915
@ConfigEntry.Gui.Tooltip
1016
public boolean showOneBar = true;
1117
@ConfigEntry.Gui.Tooltip
18+
public boolean compatibilityMode = false;
19+
@ConfigEntry.Gui.Tooltip
1220
public boolean healthEstimates = true;
1321
@ConfigEntry.Gui.Tooltip
1422
public boolean uhcMode = false;
@@ -63,6 +71,10 @@ public static class GoodThings {
6371
public int heldFoodHungerGoodColor = 0xBF76FF03;
6472
@ConfigEntry.ColorPicker(allowAlpha = true)
6573
public int heldFoodHungerWasteColor = 0xA6FFB04C;
74+
@ConfigEntry.Gui.Tooltip
75+
public boolean showSaturationBar = false;
76+
@ConfigEntry.ColorPicker(allowAlpha = true)
77+
public int saturationColor = 0xE6F9A825;
6678
}
6779

6880
public static class BadThings {
@@ -141,6 +153,8 @@ public static class Armor {
141153
}
142154

143155
public static class OtherBars {
156+
@ConfigEntry.Gui.Tooltip
157+
public boolean hotbarTooltipsDown = true;
144158
@ConfigEntry.Gui.Tooltip
145159
public boolean adaptiveXpBar = true;
146160
@ConfigEntry.ColorPicker(allowAlpha = true)
@@ -152,13 +166,10 @@ public static class OtherBars {
152166
@ConfigEntry.ColorPicker(allowAlpha = true)
153167
public int lapisColor = 0xFF2196F3;
154168
@ConfigEntry.Gui.Tooltip
155-
public boolean showSaturationBar = false;
156-
@ConfigEntry.ColorPicker(allowAlpha = true)
157-
public int saturationColor = 0xE6F9A825;
158-
@ConfigEntry.Gui.Tooltip
159-
public boolean hotbarTooltipsDown = true;
169+
@ConfigEntry.BoundedDiscrete(max = 2, min = 0)
170+
public int locatorBarMode = LocatorBarMode.HOTBAR.ordinal();
160171
@ConfigEntry.Gui.Tooltip
161-
public boolean compatibilityMode = false;
172+
public boolean showLocatability = false;
162173
}
163174

164175
@ConfigEntry.Category("textSettings")

src/main/java/io/github/madis0/OneBarElements.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import net.minecraft.client.MinecraftClient;
77
import net.minecraft.client.font.TextRenderer;
88
import net.minecraft.client.gui.DrawContext;
9-
import net.minecraft.client.render.RenderLayer;
109
import net.minecraft.component.DataComponentTypes;
1110
import net.minecraft.component.type.AttributeModifiersComponent;
1211
import net.minecraft.entity.EquipmentSlot;
@@ -77,7 +76,7 @@ public void renderOneBar(){
7776
if(config.armor.showArmorBar) armorBar();
7877
if(config.armor.showArmorDurabilityBar) armorDurabilityBar();
7978
if(config.armor.showElytraDurabilityBar) elytraDurabilityBar();
80-
if(config.otherBars.showSaturationBar) saturationBar();
79+
if(config.goodThings.showSaturationBar) saturationBar();
8180
//if(config.healthEstimates && config.otherBars.showSaturationBar) heldFoodSaturationBar();
8281

8382
// if(hasExordium) {
@@ -91,7 +90,7 @@ private void renderBar(int x1, int y1, int x2, int y2, int color){
9190
if(!config.enableGradient)
9291
drawContext.fill(x1, y1, x2, y2, color);
9392
else
94-
drawContext.fillGradient(RenderLayer.getGui(), x1, y1, x2, y2, color, Calculations.manipulateColor(color, config.gradientShift), 0);
93+
drawContext.fillGradient(x1, y1, x2, y2, color, Calculations.manipulateColor(color, config.gradientShift));
9594
}
9695

9796
private void renderLeftToRightBar(float currentValue, float maxValue, int color) {
@@ -172,7 +171,7 @@ private void elytraDurabilityBar(){
172171
}
173172

174173
private void saturationBar(){
175-
renderLeftToRightBar(playerProperties.saturationRaw, playerProperties.maxFoodLevelRaw, config.otherBars.saturationColor, clientProperties.saturationStartH, clientProperties.saturationEndH);
174+
renderLeftToRightBar(playerProperties.saturationRaw, playerProperties.maxFoodLevelRaw, config.goodThings.saturationColor, clientProperties.saturationStartH, clientProperties.saturationEndH);
176175
}
177176

178177
private void heldFoodHungerBar(){
@@ -317,8 +316,6 @@ private void barText(){
317316
value += plus + Calculations.emojiOrText("text.onebar.resistanceEmoji","text.onebar.resistance", false, playerProperties.resistancePercent);
318317
if(PlayerProperties.getMobHead(Objects.requireNonNull(client.player)) != null && config.armor.showMobHeads)
319318
value += plus + PlayerProperties.getMobHead(client.player);
320-
if(playerProperties.hasPiglinDeterArmorItem && config.armor.showMobHeads)
321-
value += plus + Calculations.emojiOrText("text.onebar.mobHeadPiglinEmoji","text.onebar.mobHeadPiglin", false, (Object) null);
322319
if(playerProperties.hasInvisibility && !playerProperties.hasAnyArmorItem && !playerProperties.hasArrowsStuck && !playerProperties.hasGlowing && config.goodThings.showInvisibility)
323320
value += plus + Calculations.emojiOrText("text.onebar.invisibilityEmoji","text.onebar.invisibility", false, (Object) null);
324321
if(playerProperties.hasInvisibility && (playerProperties.hasAnyArmorItem || playerProperties.hasArrowsStuck || playerProperties.hasGlowing) && config.goodThings.showInvisibility)
@@ -363,9 +360,11 @@ private void barText(){
363360
if (playerProperties.hasBadOmen && config.badThings.showOmens)
364361
value += minus + Calculations.emojiOrText("text.onebar.badOmenEmoji","text.onebar.badOmen", false, playerProperties.badOmenLevel);
365362
if (playerProperties.hasRaidOmen && config.badThings.showOmens)
366-
value += minus + Calculations.emojiOrText("text.onebar.raidOmenEmoji","text.onebar.raidOmen", false, playerProperties.raidOmenLevel);
363+
value += minus + Calculations.emojiOrText("text.onebar.raidOmenEmoji","text.onebar.raidOmen", false, playerProperties.raidOmenWaves);
367364
if (playerProperties.hasTrialOmen && config.badThings.showOmens)
368-
value += minus + Calculations.emojiOrText("text.onebar.trialOmenEmoji","text.onebar.trialOmen", false, playerProperties.trialOmenLevel);
365+
value += minus + Calculations.emojiOrText("text.onebar.trialOmenEmoji","text.onebar.trialOmen", false, playerProperties.trialOmenMinutes);
366+
if(playerProperties.isVisibleOnLocatorBar && config.otherBars.showLocatability)
367+
value += minus + Calculations.emojiOrText("text.onebar.locatorEmoji","text.onebar.locator", false, (Object) null);
369368
if (clientProperties.isHardcore)
370369
value += minus + Calculations.emojiOrText("text.onebar.hardcoreEmoji","text.onebar.hardcore", false, (Object) null);
371370
if (hasHunger || (playerProperties.hasHungerEffect && config.healthEstimates && !config.disableHunger))
@@ -441,6 +440,17 @@ else if(client.options.getMainArm().getValue() == Arm.LEFT)
441440
}
442441
}
443442

443+
public void mountJumpBar() {
444+
var entity = client.player.getControllingVehicle();
445+
if (entity == null) return;
446+
447+
if (entity instanceof CamelEntity) {
448+
camelJumpBar();
449+
} else {
450+
horseJumpBar(); // Horse or modded entity
451+
}
452+
}
453+
444454
public void horseJumpBar(){
445455
int barHeight = Calculations.getPreciseInt(1.0F);
446456
int jumpHeight = Calculations.getPreciseInt(Objects.requireNonNull(client.player).getMountJumpStrength());

0 commit comments

Comments
 (0)