Unify android ability wheel render logic
This commit is contained in:
parent
32f5b2ece9
commit
6cd050e0a7
@ -222,27 +222,26 @@ object AndroidMenuKeyMapping : KeyMapping("key.otm.android_menu", KeyConflictCon
|
|||||||
event.poseStack.pushPose()
|
event.poseStack.pushPose()
|
||||||
event.poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
event.poseStack.translate(minecraft.window.guiScaledWidth.toDouble() / 2f, minecraft.window.guiScaledHeight.toDouble() / 2f, 0.0)
|
||||||
|
|
||||||
if (features.size == 1) {
|
for ((index, feature) in features.withIndex()) {
|
||||||
val feature = features.first()
|
var sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
||||||
|
var cos = cos((index + 0.5) * degreePerSlice).toFloat()
|
||||||
|
|
||||||
feature.renderIcon(event.poseStack, -iconSizeSelected / 2f, -size * linearInterpolation(lastSelectProgress.getFloat(feature), 0.7f, 0.8f) - iconSizeSelected / 2f, iconSizeSelected, iconSizeSelected)
|
if (features.size == 1) {
|
||||||
} else {
|
sin = sin(PI / 2.0).toFloat()
|
||||||
for ((index, feature) in features.withIndex()) {
|
cos = cos(PI / 2.0).toFloat()
|
||||||
val sin = sin((index + 0.5) * degreePerSlice).toFloat()
|
}
|
||||||
val cos = cos((index + 0.5) * degreePerSlice).toFloat()
|
|
||||||
|
|
||||||
val shift = size * 0.6f
|
val shift = size * 0.6f
|
||||||
feature.renderIcon(event.poseStack, -iconSize / 2f + shift * cos, -shift * sin - iconSize / 2f, iconSize, iconSize)
|
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 + 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)
|
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.cooldownPercent > 0.0f) {
|
if (feature.isOnCooldown && feature.cooldownPercent > 0.0f) {
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 0.5f)
|
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.cooldownPercent.toDouble())
|
drawArc(event.poseStack, shift * cos, -shift * sin, iconSize / 2f, 0f, PI / 2.0, PI / 2.0 + PI * 2.0 * feature.cooldownPercent.toDouble())
|
||||||
RenderSystem.setShaderColor(1f, 1f, 1f, 1f)
|
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)
|
minecraft.font.drawAligned(event.poseStack, formatTickDuration(feature.cooldown), TextAlign.CENTER_CENTER, shift * cos, -shift * sin + iconSize / 1.5f, RGBAColor.WHITE)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user