НЕТ НУ ЕСЛИ ТЕПЕРЬ У НАС ЕСТЬ ТАКОЙ ШРИФТ ТО Я БУДУ ЕГО АБУЗИТЬ
и вы мне ничего не сделаете понятно?
This commit is contained in:
parent
a00225e859
commit
18b89b4031
@ -192,6 +192,10 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
gui("holo_screen.resize_text", "Resize text automatically")
|
||||
gui("holo_screen.do_not_resize_text", "Do not resize text")
|
||||
|
||||
gui("abc", "ABC")
|
||||
gui("use_standard_font", "Use standard font")
|
||||
gui("use_small_font", "Use small font")
|
||||
|
||||
gui("ticks", "Ticks")
|
||||
|
||||
gui("power_cost_per_use", "Power cost per use: %s")
|
||||
|
@ -202,6 +202,10 @@ private fun misc(provider: MatteryLanguageProvider) {
|
||||
gui("holo_screen.resize_text", "Изменять размер текста автоматически")
|
||||
gui("holo_screen.do_not_resize_text", "Не менять размер текста")
|
||||
|
||||
gui("abc", "АБВ")
|
||||
gui("use_standard_font", "Использовать стандартный шрифт")
|
||||
gui("use_small_font", "Использовать уменьшенный шрифт")
|
||||
|
||||
gui("ticks", "Тиков")
|
||||
|
||||
gui("power_cost_per_use", "Энергии на операцию: %s")
|
||||
|
@ -61,6 +61,11 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
|
||||
access.accept(value)
|
||||
}).delegate
|
||||
|
||||
var smallerFont by syncher.boolean(false, setter = { access, value ->
|
||||
setChanged()
|
||||
access.accept(value)
|
||||
}).delegate
|
||||
|
||||
var isLocked = false
|
||||
|
||||
init {
|
||||
@ -74,6 +79,7 @@ class HoloSignBlockEntity(blockPos: BlockPos, blockState: BlockState) : MatteryB
|
||||
savetablesConfig.float(::textAlpha)
|
||||
|
||||
savetablesConfig.bool(::textAutoScale)
|
||||
savetablesConfig.bool(::smallerFont)
|
||||
}
|
||||
|
||||
override fun createMenu(p_39954_: Int, p_39955_: Inventory, p_39956_: Player): AbstractContainerMenu {
|
||||
|
@ -113,8 +113,9 @@ object MatteryGUI {
|
||||
event.registerAbove(VanillaGuiLayers.CAMERA_OVERLAYS, loc("android_low_power"), AndroidLowPowerLayer())
|
||||
}
|
||||
|
||||
private val SMALL_FONT = loc("small")
|
||||
private val SMALL_FONT_STYLE = Style.EMPTY.withFont(SMALL_FONT)
|
||||
val SMALL_FONT = loc("small")
|
||||
val SMALL_FONT_STYLE: Style = Style.EMPTY.withFont(SMALL_FONT)
|
||||
val STANDARD_FONT_STYLE: Style = Style.EMPTY
|
||||
|
||||
class AndroidEnergyBarLayer : LayeredDraw.Layer {
|
||||
override fun render(
|
||||
@ -168,7 +169,7 @@ object MatteryGUI {
|
||||
|
||||
val formattedPower = mattery.androidEnergy.batteryLevel.formatPower()
|
||||
val scale = if (ClientConfig.HUD.USE_SMALL_FONT) 1f else ClientConfig.HUD.BAR_TEXT_SCALE.toFloat()
|
||||
guiGraphics.draw(formattedPower.withStyle(if (ClientConfig.HUD.USE_SMALL_FONT) SMALL_FONT_STYLE else Style.EMPTY), left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, font = gui.font, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.FULL_POWER, drawOutline = true)
|
||||
guiGraphics.draw(formattedPower.withStyle(if (ClientConfig.HUD.USE_SMALL_FONT) SMALL_FONT_STYLE else STANDARD_FONT_STYLE), left + CHARGE_BG.width + 2f + scale, top + CHARGE_BG.height / 2f + scale, font = gui.font, scale = scale, gravity = RenderGravity.CENTER_LEFT, color = RGBAColor.FULL_POWER, drawOutline = true)
|
||||
|
||||
RenderSystem.disableBlend()
|
||||
RenderSystem.enableDepthTest()
|
||||
@ -234,7 +235,7 @@ object MatteryGUI {
|
||||
formattedHealth = TextComponent("%d+%d/%d".format(ply.health.toInt(), ply.absorptionAmount.toInt(), ply.maxHealth.toInt()))
|
||||
|
||||
val scale = if (ClientConfig.HUD.USE_SMALL_FONT) 1f else ClientConfig.HUD.BAR_TEXT_SCALE.toFloat()
|
||||
guiGraphics.draw(formattedHealth.withStyle(if (ClientConfig.HUD.USE_SMALL_FONT) SMALL_FONT_STYLE else Style.EMPTY), left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true)
|
||||
guiGraphics.draw(formattedHealth.withStyle(if (ClientConfig.HUD.USE_SMALL_FONT) SMALL_FONT_STYLE else STANDARD_FONT_STYLE), left - 2f, top + HEALTH_BG.height / 2f + 1f * scale, scale = scale, gravity = RenderGravity.CENTER_RIGHT, color = getHealthColorForPlayer(ply), drawOutline = true)
|
||||
|
||||
RenderSystem.disableBlend()
|
||||
RenderSystem.enableDepthTest()
|
||||
|
@ -12,6 +12,9 @@ import ru.dbotthepony.mc.otm.client.render.draw
|
||||
import ru.dbotthepony.mc.otm.core.get
|
||||
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI.SMALL_FONT_STYLE
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI.STANDARD_FONT_STYLE
|
||||
import ru.dbotthepony.mc.otm.core.TextComponent
|
||||
import ru.dbotthepony.mc.otm.core.math.rotateWithBlockFacing
|
||||
|
||||
class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context) : BlockEntityRenderer<HoloSignBlockEntity> {
|
||||
@ -42,8 +45,9 @@ class HoloSignRenderer(private val context: BlockEntityRendererProvider.Context)
|
||||
poseStack.scale(mul, mul, mul)
|
||||
}
|
||||
|
||||
val style = if (tile.smallerFont) SMALL_FONT_STYLE else STANDARD_FONT_STYLE
|
||||
for (line in lines) {
|
||||
font.draw(poseStack = poseStack, buffer = bufferSource, text = line, gravity = RenderGravity.TOP_CENTER, y = y, color = RGBAColor(tile.textRed, tile.textGreen, tile.textBlue, tile.textAlpha))
|
||||
font.draw(poseStack = poseStack, buffer = bufferSource, text = TextComponent(line).withStyle(style), gravity = RenderGravity.TOP_CENTER, y = y, color = RGBAColor(tile.textRed, tile.textGreen, tile.textBlue, tile.textAlpha))
|
||||
y += font.lineHeight + 2f
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,8 @@ import ru.dbotthepony.mc.otm.client.screen.panels.input.NetworkedStringInputPane
|
||||
import ru.dbotthepony.mc.otm.core.TranslatableComponent
|
||||
import ru.dbotthepony.kommons.math.RGBAColor
|
||||
import ru.dbotthepony.mc.otm.block.entity.decorative.HoloSignBlockEntity
|
||||
import ru.dbotthepony.mc.otm.client.MatteryGUI.SMALL_FONT_STYLE
|
||||
import ru.dbotthepony.mc.otm.client.render.TextIcon
|
||||
import ru.dbotthepony.mc.otm.client.render.Widgets18
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.BooleanButtonPanel
|
||||
import ru.dbotthepony.mc.otm.client.screen.panels.button.ButtonPanel
|
||||
@ -84,6 +86,16 @@ class HoloSignScreen(menu: HoloSignMenu, inventory: Inventory, title: Component)
|
||||
tooltipInactive = TranslatableComponent("otm.gui.lock_holo_screen.unlocked")
|
||||
))
|
||||
|
||||
controls.addButton(BooleanButtonPanel.square18(
|
||||
this@HoloSignScreen,
|
||||
frame,
|
||||
prop = menu.smallerFont,
|
||||
iconActive = TextIcon(font = font, text = TranslatableComponent("otm.gui.abc").withStyle(SMALL_FONT_STYLE)),
|
||||
iconInactive = TextIcon(font = font, text = TranslatableComponent("otm.gui.abc")),
|
||||
tooltipActive = TranslatableComponent("otm.gui.use_small_font"),
|
||||
tooltipInactive = TranslatableComponent("otm.gui.use_standard_font")
|
||||
))
|
||||
|
||||
return frame
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,7 @@ class HoloSignMenu(
|
||||
val textBlue = FloatInputWithFeedback(this)
|
||||
val textAlpha = FloatInputWithFeedback(this)
|
||||
val textAutoScale = BooleanInputWithFeedback(this)
|
||||
val smallerFont = BooleanInputWithFeedback(this)
|
||||
|
||||
init {
|
||||
text.filter { it.isCreative || !locked.value }
|
||||
@ -36,6 +37,7 @@ class HoloSignMenu(
|
||||
textAlpha.filter { it.isCreative || !locked.value }
|
||||
|
||||
textAutoScale.filter { it.isCreative || !locked.value }
|
||||
smallerFont.filter { it.isCreative || !locked.value }
|
||||
|
||||
if (tile != null) {
|
||||
text.withConsumer { tile.signText = HoloSignBlockEntity.truncate(it, tile.isLocked) }.withSupplier(tile::signText)
|
||||
@ -46,6 +48,7 @@ class HoloSignMenu(
|
||||
locked.with(tile::isLocked)
|
||||
redstone.with(tile.redstoneControl::redstoneSetting)
|
||||
textAutoScale.with(tile::textAutoScale)
|
||||
smallerFont.with(tile::smallerFont)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user