отображение кулдауна на колесе #124

This commit is contained in:
YuRaNnNzZZ 2022-10-14 14:38:46 +03:00
parent cace26411a
commit 120c6b39a2
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D

View File

@ -16,10 +16,7 @@ import ru.dbotthepony.mc.otm.capability.matteryPlayer
import ru.dbotthepony.mc.otm.client.render.TextAlign
import ru.dbotthepony.mc.otm.client.render.drawAligned
import ru.dbotthepony.mc.otm.client.render.drawArc
import ru.dbotthepony.mc.otm.core.RGBAColor
import ru.dbotthepony.mc.otm.core.angleDifference
import ru.dbotthepony.mc.otm.core.linearInterpolation
import ru.dbotthepony.mc.otm.core.normalizeAngle
import ru.dbotthepony.mc.otm.core.*
import ru.dbotthepony.mc.otm.network.MatteryPlayerNetworkChannel
import ru.dbotthepony.mc.otm.network.SwitchAndroidFeaturePacket
import java.util.stream.Collectors
@ -239,6 +236,14 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
feature.renderIcon(event.poseStack, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize)
minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos + 1f, -shift * sin - iconSize / 1.5f + 1f, 0)
minecraft.font.drawAligned(event.poseStack, feature.type.displayName, TextAlign.CENTER_CENTER, shift * cos, -shift * sin - iconSize / 1.5f, if (feature.isActive) RGBAColor.DARK_GREEN else RGBAColor.DARK_RED)
if (feature.isOnCooldown && feature.getCooldownPercent() > 0.0f) {
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
drawArc(event.poseStack, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.getCooldownPercent().toDouble())
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
minecraft.font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)
}
}
}