Skip to content

Commit 3238a5d

Browse files
committed
Update version to 1.0.0 and fixed UIPanorama rendering logic
1 parent b9f71f8 commit 3238a5d

File tree

1 file changed

+9
-5
lines changed
  • src/main/java/com/github/kdgaming0/packcore/screen/components

1 file changed

+9
-5
lines changed

src/main/java/com/github/kdgaming0/packcore/screen/components/UIPanorama.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ class UIPanorama : UIContainer() {
1414

1515
private val mc = Minecraft.getMinecraft()
1616
var panoramaTimer = 0 // Drives rotation
17+
private var panoramaRotation = 0.0f
18+
private var lastUpdateTime = System.currentTimeMillis()
1719

1820
// Your custom panorama textures (ensure these exist)
1921
private val panoramaTextures = arrayOf(
@@ -26,11 +28,13 @@ class UIPanorama : UIContainer() {
2628
)
2729

2830
override fun draw(matrixStack: UMatrixStack) {
29-
// Update timer for animation
30-
panoramaTimer++
31+
// Calculate delta time
32+
val currentTime = System.currentTimeMillis()
33+
val deltaTime = (currentTime - lastUpdateTime) / 1000f
34+
lastUpdateTime = currentTime
3135

32-
// Using a default partialTicks value since UIContainer doesn't provide one
33-
val partialTicks = 0.0f
36+
// Update rotation based on time
37+
panoramaRotation += deltaTime * 20f // Adjust the multiplier to control rotation speed
3438

3539
val tessellator = Tessellator.getInstance()
3640
val worldRenderer = tessellator.worldRenderer
@@ -49,7 +53,7 @@ class UIPanorama : UIContainer() {
4953
GL11.glRotatef(180.0f, 1.0f, 0.0f, 0.0f)
5054

5155
// Apply additional rotation for the animation
52-
GL11.glRotatef(-((panoramaTimer.toFloat() + partialTicks) * 0.05f), 0.0f, 1.0f, 0.0f)
56+
GL11.glRotatef(-panoramaRotation * 0.1f, 0.0f, 1.0f, 0.0f)
5357

5458
// Configure GL state for smooth rendering.
5559
GlStateManager.enableBlend()

0 commit comments

Comments
 (0)