hud text scale + reorganize client config
This commit is contained in:
parent
122ebb9688
commit
586c43fd6c
@ -229,7 +229,7 @@ fun onMouseScrolled(event: MouseScrolled.Pre) {
|
||||
return
|
||||
}
|
||||
|
||||
if (ClientConfig.EXOPACK_FREE_SCROLL && widget.panel is InventoryScrollbarPanel) {
|
||||
if (ClientConfig.GUI.EXOPACK_FREE_SCROLL && widget.panel is InventoryScrollbarPanel) {
|
||||
val slot = screen.slotUnderMouse
|
||||
|
||||
if (slot != null && (slot.container == minecraft.player?.inventory && slot.containerSlot in 9 .. 35 || slot.container == minecraft.player?.matteryPlayer?.exopackContainer)) {
|
||||
@ -266,7 +266,7 @@ private val TOOLTIP_TAG_DISPLAY_ITEM_TITLE = TranslatableComponent("otm.gui.debu
|
||||
private val TOOLTIP_TAG_DISPLAY_BLOCK_TITLE = TranslatableComponent("otm.gui.debug.tags.block.title").withStyle(ChatFormatting.DARK_GRAY)
|
||||
|
||||
fun tooltipEvent(event: ItemTooltipEvent) {
|
||||
if (event.flags.isAdvanced && ClientConfig.TOOLTIP_DISPLAY_TAGS && !event.itemStack.isEmpty) {
|
||||
if (event.flags.isAdvanced && ClientConfig.Tooltip.DISPLAY_TAGS && !event.itemStack.isEmpty) {
|
||||
val itemTags = ArrayList<TagKey<Item>>()
|
||||
if (event.itemStack.tags.count() > 0) {
|
||||
itemTags.addAll(event.itemStack.tags)
|
||||
|
@ -262,7 +262,8 @@ object MatteryGUI {
|
||||
|
||||
val formattedPower = mattery.androidEnergy.batteryLevel.formatPower()
|
||||
|
||||
event.guiGraphics.draw(gui.font, formattedPower, left + CHARGE_BG.width + 1f, top + CHARGE_BG.height / 2f, scale = 0.5f, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true)
|
||||
val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat()
|
||||
event.guiGraphics.draw(gui.font, formattedPower, left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.YELLOW, drawOutline = true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +292,7 @@ object MatteryGUI {
|
||||
} // можно вынести в конфиг, но для этого нужен селектор цвета
|
||||
|
||||
private fun renderPlayerHealth(event: RenderGuiOverlayEvent.Pre, gui: ForgeGui) {
|
||||
if (!ClientConfig.ANDROID_HEALTH_HUD) return
|
||||
if (!ClientConfig.HUD.ANDROID_HEALTH_BAR) return
|
||||
|
||||
val ply: LocalPlayer = minecraft.player ?: return
|
||||
var mattery = ply.matteryPlayer
|
||||
@ -338,7 +339,8 @@ object MatteryGUI {
|
||||
if (ply.absorptionAmount > 0)
|
||||
formattedHealth = TextComponent("%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt()))
|
||||
|
||||
event.guiGraphics.draw(minecraft.font, formattedHealth, left - 2f, top + HEALTH_BG.height / 2f, scale = 0.5f, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true)
|
||||
val scale = ClientConfig.HUD.BAR_TEXT_SCALE.toFloat()
|
||||
event.guiGraphics.draw(minecraft.font, formattedHealth, left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -747,6 +747,6 @@ abstract class MatteryScreen<T : MatteryMenu>(menu: T, inventory: Inventory, tit
|
||||
const val MAX_ROWS = 6
|
||||
|
||||
var lastScroll = 0
|
||||
var lastRows by ClientConfig::EXOPACK_INVENTORY_ROWS
|
||||
var lastRows by ClientConfig.GUI::EXOPACK_INVENTORY_ROWS
|
||||
}
|
||||
}
|
||||
|
@ -65,9 +65,9 @@ private fun <S : MatteryScreen<*>> makeRedstoneSettingButton(
|
||||
set(value) {}
|
||||
|
||||
init {
|
||||
add(RedstoneSetting.IGNORED, tooltip = RedstoneSetting.IGNORED.description, skinElement = if (ClientConfig.REDSTONE_CONTROLS_ITEM_ICONS) gunpowder else Widgets18.REDSTONE_IGNORED)
|
||||
add(RedstoneSetting.LOW, tooltip = RedstoneSetting.LOW.description, skinElement = if (ClientConfig.REDSTONE_CONTROLS_ITEM_ICONS) redstoneUnderBarrier else Widgets18.REDSTONE_LOW)
|
||||
add(RedstoneSetting.HIGH, tooltip = RedstoneSetting.HIGH.description, skinElement = if (ClientConfig.REDSTONE_CONTROLS_ITEM_ICONS) redstone else Widgets18.REDSTONE_HIGH)
|
||||
add(RedstoneSetting.IGNORED, tooltip = RedstoneSetting.IGNORED.description, skinElement = if (ClientConfig.GUI.REDSTONE_CONTROLS_ITEM_ICONS) gunpowder else Widgets18.REDSTONE_IGNORED)
|
||||
add(RedstoneSetting.LOW, tooltip = RedstoneSetting.LOW.description, skinElement = if (ClientConfig.GUI.REDSTONE_CONTROLS_ITEM_ICONS) redstoneUnderBarrier else Widgets18.REDSTONE_LOW)
|
||||
add(RedstoneSetting.HIGH, tooltip = RedstoneSetting.HIGH.description, skinElement = if (ClientConfig.GUI.REDSTONE_CONTROLS_ITEM_ICONS) redstone else Widgets18.REDSTONE_HIGH)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,74 @@
|
||||
package ru.dbotthepony.mc.otm.config
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec
|
||||
import net.minecraftforge.fml.ModLoadingContext
|
||||
import net.minecraftforge.fml.config.ModConfig
|
||||
|
||||
object ClientConfig : AbstractConfig("client", ModConfig.Type.CLIENT) {
|
||||
var ALWAYS_DISPLAY_MATTER_VALUE: Boolean by builder
|
||||
.define("ALWAYS_DISPLAY_MATTER_VALUE", false)
|
||||
|
||||
var EXOPACK_INVENTORY_ROWS: Int by builder
|
||||
.comment("Amount of inventory rows to show when wearing Exosuit")
|
||||
.defineInRange("EXOPACK_INVENTORY_ROWS", 3, 3, 6)
|
||||
|
||||
var JUMP_BOOST_LOOK_ANGLE: Double by builder
|
||||
.comment("If looking below this angle (actually, looking 'above' as you see in game, but not as you expect it, check with debug screen), Crouch + Jump will trigger jump boost android ability")
|
||||
.defineInRange("JUMP_BOOST_LOOK_ANGLE", 30.0, -180.0, 180.0)
|
||||
|
||||
object Tooltip {
|
||||
init {
|
||||
builder.push("Tooltip")
|
||||
}
|
||||
|
||||
var ALWAYS_DISPLAY_MATTER_VALUE: Boolean by builder
|
||||
.comment("Always display matter value in tooltips without requiring holding Shift key")
|
||||
.define("ALWAYS_DISPLAY_MATTER_VALUE", false)
|
||||
|
||||
var DISPLAY_TAGS: Boolean by builder
|
||||
.comment("Display block/item tags in advanced item tooltips")
|
||||
.define("DISPLAY_TAGS", false)
|
||||
|
||||
init {
|
||||
builder.pop()
|
||||
}
|
||||
}
|
||||
|
||||
object GUI {
|
||||
init {
|
||||
builder.comment("Inventory/GUI options").push("Gui")
|
||||
}
|
||||
|
||||
var EXOPACK_INVENTORY_ROWS: Int by builder
|
||||
.comment("Amount of inventory rows to show when wearing Exosuit")
|
||||
.defineInRange("EXOPACK_INVENTORY_ROWS", 3, 3, 6)
|
||||
|
||||
var EXOPACK_FREE_SCROLL: Boolean by builder
|
||||
.comment("Allow to scroll Exopack inventory in non OTM inventories when hovering just over inventory slots, not only scrollbar")
|
||||
.define("EXOPACK_FREE_SCROLL", true)
|
||||
|
||||
var ANDROID_HEALTH_HUD: Boolean by builder
|
||||
.comment("Replace hearts with health bar on HUD when you are an android")
|
||||
.define("ANDROID_HEALTH_HUD", true)
|
||||
|
||||
var REDSTONE_CONTROLS_ITEM_ICONS: Boolean by builder
|
||||
.comment("Display redstone control button using items instead of custom sprites")
|
||||
.comment("For those who want it.")
|
||||
.define("REDSTONE_CONTROLS_ITEM_ICONS", false)
|
||||
|
||||
var TOOLTIP_DISPLAY_TAGS: Boolean by builder
|
||||
.comment("Display block/item tags in advanced item tooltips")
|
||||
.define("TOOLTIP_DISPLAY_TAGS", false)
|
||||
init {
|
||||
builder.pop()
|
||||
}
|
||||
}
|
||||
|
||||
object HUD {
|
||||
init {
|
||||
builder.push("HUD")
|
||||
}
|
||||
|
||||
var ANDROID_HEALTH_BAR: Boolean by builder
|
||||
.comment("Replace hearts with health bar on HUD when you are an android")
|
||||
.define("ANDROID_HEALTH_BAR", true)
|
||||
|
||||
var BAR_TEXT_SCALE: Double by builder
|
||||
.defineInRange("BAR_TEXT_SCALE", 0.5, 0.5, 1.0)
|
||||
|
||||
init {
|
||||
builder.pop()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
Tooltip
|
||||
GUI
|
||||
HUD
|
||||
}
|
||||
}
|
||||
|
@ -1345,10 +1345,10 @@ object MatterManager {
|
||||
return getResearchAdvance(this@MatterManager.get(stack.asItem()).complexity)
|
||||
}
|
||||
|
||||
private val formatMatterAsReadable = BooleanSupplier { if (ClientConfig.ALWAYS_DISPLAY_MATTER_VALUE) minecraft.window.isShiftDown else minecraft.window.isShiftDown && milliTime % 2_000L > 1_000L }
|
||||
private val formatMatterAsReadable = BooleanSupplier { if (ClientConfig.Tooltip.ALWAYS_DISPLAY_MATTER_VALUE) minecraft.window.isShiftDown else minecraft.window.isShiftDown && milliTime % 2_000L > 1_000L }
|
||||
|
||||
fun tooltipEvent(event: ItemTooltipEvent) {
|
||||
if (ClientConfig.ALWAYS_DISPLAY_MATTER_VALUE || minecraft.window.isShiftDown) {
|
||||
if (ClientConfig.Tooltip.ALWAYS_DISPLAY_MATTER_VALUE || minecraft.window.isShiftDown) {
|
||||
val matter = get(event.itemStack, accountForStackSize = false)
|
||||
|
||||
if (matter.hasMatterValue) {
|
||||
|
Loading…
Reference in New Issue
Block a user