Skip to content

Commit

Permalink
Merge pull request #15 from SyberiaKey/localize
Browse files Browse the repository at this point in the history
Implement #5 + localization for config comments (now tooltips) and mod description in Mod Menu
  • Loading branch information
NebelNidas authored Jun 19, 2022
2 parents 9550188 + ab36012 commit fe2bb9a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ public class ModConfig implements ConfigData {
public static class ArmorBars {
public boolean displayArmorBars = true;
public boolean displayBarsForUndamagedArmor = true;

@Comment("If armor is undamaged, its bar will have custom color.")
@ConfigEntry.Gui.Tooltip
public boolean useCustomColorInBarsForUndamagedArmor = true;

@ConfigEntry.ColorPicker(allowAlpha = true)
public int customColorInBarsForUndamagedArmor = 0xFFFFFFFF;
}


Expand All @@ -28,14 +35,17 @@ public static class LowDurabilityWarning {
public boolean onlyOnMendingItems = true;

@Comment("An item's durability has to be below both the minimum point value and the minimum percentage for the warning to show!")
@ConfigEntry.Gui.Tooltip
@ConfigEntry.BoundedDiscrete(min = 1, max = 250)
public int minDurabilityPointsBeforeWarning = 100;

@Comment("An item's durability has to be below both the minimum point value and the minimum percentage for the warning to show!")
@ConfigEntry.Gui.Tooltip
@ConfigEntry.BoundedDiscrete(min = 1, max = 99)
public int minDurabilityPercentageBeforeWarning = 10;

@Comment("Set to 0 to disable blinking")
@Comment("Set to 0 to disable blinking.")
@ConfigEntry.Gui.Tooltip
@ConfigEntry.BoundedDiscrete(min = 0, max = 5)
public float blinkTime = 1f;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,12 @@ public void renderBar(ItemStack stack, int x, int y) {
int width = stack.getItemBarStep();
int color = stack.getItemBarColor();
this.renderGuiQuad(bufferBuilder, x, y, 13, 2, 0, 0, 0, 255);
this.renderGuiQuad(bufferBuilder, x, y, width, 1, color >> 16 & 255, color >> 8 & 255, color & 255, 255);
if (!stack.isDamaged() && MicroDurability.config.armorBars.useCustomColorInBarsForUndamagedArmor) {
int argb = MicroDurability.config.armorBars.customColorInBarsForUndamagedArmor;
this.renderGuiQuad(bufferBuilder, x, y, 13, 1, ((argb >> 16) & 0xFF) & 255, ((argb >> 8) & 0xFF) & 255, (argb & 0xFF) & 255, ((argb >> 24) & 0xFF) & 255);
} else {
this.renderGuiQuad(bufferBuilder, x, y, width, 1, color >> 16 & 255, color >> 8 & 255, color & 255, 255);
}
RenderSystem.enableBlend();
RenderSystem.enableTexture();
RenderSystem.enableDepthTest();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,21 @@
"text.autoconfig.microdurability.category.armorBars": "Armor Bars",
"text.autoconfig.microdurability.option.armorBars.displayArmorBars": "Display armor bars",
"text.autoconfig.microdurability.option.armorBars.displayBarsForUndamagedArmor": "Display bars for undamaged armor",
"text.autoconfig.microdurability.option.armorBars.useCustomColorInBarsForUndamagedArmor": "Use custom color in bars for undamaged armor",
"text.autoconfig.microdurability.option.armorBars.useCustomColorInBarsForUndamagedArmor.@Tooltip": "If armor is undamaged, its bar will have custom color.",
"text.autoconfig.microdurability.option.armorBars.customColorInBarsForUndamagedArmor": "Custom color in bars for undamaged armor (#ARGB format)",

"text.autoconfig.microdurability.category.lowDurabilityWarning": "Low Durability Warning",
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForTools": "Display warning for tools",
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForArmor": "Display warning for armor",
"text.autoconfig.microdurability.option.lowDurabilityWarning.onlyOnMendingItems": "Display only on mending items",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPointsBeforeWarning": "Minimum durability points before showing the warning",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPointsBeforeWarning.@Tooltip": "An item's durability has to be below both the minimum point value and the minimum percentage for the warning to show!",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPercentageBeforeWarning": "Minimum durability percentage before showing the warning",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime": "Blink speed (in seconds)"
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPercentageBeforeWarning.@Tooltip": "An item's durability has to be below both the minimum point value and the minimum percentage for the warning to show!",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime": "Blink speed (in seconds)",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime.@Tooltip": "Set to 0 to disable blinking.",

"modmenu.summaryTranslation.microdurability": "A very minimal durability viewer",
"modmenu.descriptionTranslation.microdurability": "A very minimal durability viewer"
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
{
"text.autoconfig.microdurability.title": "Конфигурация microDurability",
"text.autoconfig.microdurability.title": "Настройки microDurability",

"text.autoconfig.microdurability.category.armorBars": "Панели брони",
"text.autoconfig.microdurability.option.armorBars.displayArmorBars": "Отобразить панель брони",
"text.autoconfig.microdurability.option.armorBars.displayBarsForUndamagedArmor": "Отобразить панели для неповреждённой брони",
"text.autoconfig.microdurability.category.armorBars": "Индикаторы брони",
"text.autoconfig.microdurability.option.armorBars.displayArmorBars": "Отображать индикаторы брони",
"text.autoconfig.microdurability.option.armorBars.displayBarsForUndamagedArmor": "Отображать индикаторы для неповреждённой брони",
"text.autoconfig.microdurability.option.armorBars.useCustomColorInBarsForUndamagedArmor": "Использовать свой цвет на индикаторах для неповреждённой брони",
"text.autoconfig.microdurability.option.armorBars.useCustomColorInBarsForUndamagedArmor.@Tooltip": "Если броня не имеет повреждений, её индикатор будет иметь указанный ниже цвет.",
"text.autoconfig.microdurability.option.armorBars.customColorInBarsForUndamagedArmor": "Свой цвет для индикаторов для неповреждённой брони (формат #ARGB)",

"text.autoconfig.microdurability.category.lowDurabilityWarning": "Предупреждение о низкой прочности",
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForTools": "Отобразить предупреждение для инструментов",
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForArmor": "Отобразить предупреждение для брони",
"text.autoconfig.microdurability.option.lowDurabilityWarning.onlyOnMendingItems": "Отобразить только на починочных предметах",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPointsBeforeWarning": "Минимум очков прочности до показа предупреждения",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPercentageBeforeWarning": "Минимум % прочности до показа предупреждения",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime": "Скорость мигания (в секундах)"
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForTools": "Отображать предупреждение для инструментов",
"text.autoconfig.microdurability.option.lowDurabilityWarning.displayWarningForArmor": "Отображать предупреждение для брони",
"text.autoconfig.microdurability.option.lowDurabilityWarning.onlyOnMendingItems": "Отображать только на предметах с зачарованием \"Починка\"",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPointsBeforeWarning": "Минимальный уровень прочности до показа предупреждения",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPointsBeforeWarning.@Tooltip": "Прочность предмета должна быть ниже минимального уровня и процента прочности для показа предупреждения.",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPercentageBeforeWarning": "Минимальный % прочности до показа предупреждения",
"text.autoconfig.microdurability.option.lowDurabilityWarning.minDurabilityPercentageBeforeWarning.@Tooltip": "Прочность предмета должна быть ниже минимального уровня и процента прочности для показа предупреждения.",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime": "Задержка между миганиями (в секундах)",
"text.autoconfig.microdurability.option.lowDurabilityWarning.blinkTime.@Tooltip": "Поставьте значение 0, чтобы отключить мигание.",

"modmenu.summaryTranslation.microdurability": "Очень минималистичный показатель прочности",
"modmenu.descriptionTranslation.microdurability": "Очень минималистичный показатель прочности"
}
3 changes: 2 additions & 1 deletion microdurability-core/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"description": "Cross Minecraft version compatible components of microDurability",
"authors": [
"NebelNidas",
"dzwdz"
"dzwdz",
"SyberiaK"
],
"contributors": [
"BlockBuilder57"
Expand Down

0 comments on commit fe2bb9a

Please sign in to comment.