diff options
author | Linnea Gräf <nea@nea.moe> | 2024-11-10 17:48:58 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-11-10 17:48:58 +0100 |
commit | 72fed8b08ef162542060ae5e4a659e77e9e1793a (patch) | |
tree | 1e17315281f6a49113b35630e6e8704d5b501b41 /src/main | |
parent | d1241fb0d94aeaa14efe68f0b14bf862d98807bf (diff) | |
download | Firmament-72fed8b08ef162542060ae5e4a659e77e9e1793a.tar.gz Firmament-72fed8b08ef162542060ae5e4a659e77e9e1793a.tar.bz2 Firmament-72fed8b08ef162542060ae5e4a659e77e9e1793a.zip |
fix: Pickaxe ability cooldown not rendering properly
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/kotlin/features/mining/PickaxeAbility.kt | 7 | ||||
-rw-r--r-- | src/main/kotlin/util/render/DrawContextExt.kt | 20 | ||||
-rw-r--r-- | src/main/kotlin/util/render/RenderCircleProgress.kt | 2 |
3 files changed, 23 insertions, 6 deletions
diff --git a/src/main/kotlin/features/mining/PickaxeAbility.kt b/src/main/kotlin/features/mining/PickaxeAbility.kt index a494989..4fcf8a7 100644 --- a/src/main/kotlin/features/mining/PickaxeAbility.kt +++ b/src/main/kotlin/features/mining/PickaxeAbility.kt @@ -127,12 +127,15 @@ object PickaxeAbility : FirmamentFeature { @Subscribe fun onProfileSwitch(event: ProfileSwitchEvent) { - lastUsage.clear() + lastUsage.entries.removeIf { + it.value < lobbyJoinTime + } } val abilityUsePattern = Pattern.compile("You used your (?<name>.*) Pickaxe Ability!") val fuelPattern = Pattern.compile("Fuel: .*/(?<maxFuel>$SHORT_NUMBER_FORMAT)") - val pickaxeAbilityCooldownPattern = Pattern.compile("Your pickaxe ability is on cooldown for (?<remainingCooldown>$TIME_PATTERN)\\.") + val pickaxeAbilityCooldownPattern = + Pattern.compile("Your pickaxe ability is on cooldown for (?<remainingCooldown>$TIME_PATTERN)\\.") data class PickaxeAbilityData( val name: String, diff --git a/src/main/kotlin/util/render/DrawContextExt.kt b/src/main/kotlin/util/render/DrawContextExt.kt index da0b0b0..a143d4d 100644 --- a/src/main/kotlin/util/render/DrawContextExt.kt +++ b/src/main/kotlin/util/render/DrawContextExt.kt @@ -8,6 +8,7 @@ import net.minecraft.client.render.RenderLayer import net.minecraft.client.render.RenderLayer.MultiPhaseParameters import net.minecraft.client.render.RenderPhase import net.minecraft.client.render.VertexFormat +import net.minecraft.client.render.VertexFormat.DrawMode import net.minecraft.client.render.VertexFormats import net.minecraft.util.Identifier import net.minecraft.util.TriState @@ -22,13 +23,26 @@ object GuiRenderLayers { val GUI_TEXTURED_NO_DEPTH = Util.memoize<Identifier, RenderLayer> { texture: Identifier -> RenderLayer.of("firmament_gui_textured_no_depth", VertexFormats.POSITION_TEXTURE_COLOR, - VertexFormat.DrawMode.QUADS, - RenderLayer.CUTOUT_BUFFER_SIZE, + DrawMode.QUADS, + DEFAULT_BUFFER_SIZE, MultiPhaseParameters.builder() .texture(RenderPhase.Texture(texture, TriState.FALSE, false)) .program(RenderPhase.POSITION_TEXTURE_COLOR_PROGRAM) .transparency(RenderPhase.TRANSLUCENT_TRANSPARENCY) - .depthTest(RenderPhase.ALWAYS_DEPTH_TEST) + .depthTest(RenderPhase.ALWAYS_DEPTH_TEST) + .build(false)) + } + val GUI_TEXTURED_TRIS = Util.memoize { texture: Identifier -> + RenderLayer.of("firmament_gui_textured_overlay_tris", + VertexFormats.POSITION_TEXTURE_COLOR, + DrawMode.TRIANGLES, + DEFAULT_BUFFER_SIZE, + MultiPhaseParameters.builder() + .texture(RenderPhase.Texture(texture, TriState.DEFAULT, false)) + .program(RenderPhase.POSITION_TEXTURE_COLOR_PROGRAM) + .transparency(RenderPhase.TRANSLUCENT_TRANSPARENCY) + .depthTest(RenderPhase.ALWAYS_DEPTH_TEST) + .writeMaskState(RenderPhase.COLOR_MASK) .build(false)) } } diff --git a/src/main/kotlin/util/render/RenderCircleProgress.kt b/src/main/kotlin/util/render/RenderCircleProgress.kt index 9cc383c..805633c 100644 --- a/src/main/kotlin/util/render/RenderCircleProgress.kt +++ b/src/main/kotlin/util/render/RenderCircleProgress.kt @@ -28,7 +28,7 @@ object RenderCircleProgress { ) { RenderSystem.enableBlend() drawContext.draw { - val bufferBuilder = it.getBuffer(RenderLayer.getGuiTexturedOverlay(texture)) + val bufferBuilder = it.getBuffer(GuiRenderLayers.GUI_TEXTURED_TRIS.apply(texture)) val matrix: Matrix4f = drawContext.matrices.peek().positionMatrix val corners = listOf( |