diff options
| author | Linnea Gräf <nea@nea.moe> | 2025-09-06 01:42:42 +0200 |
|---|---|---|
| committer | Linnea Gräf <nea@nea.moe> | 2025-09-06 01:42:42 +0200 |
| commit | 781e204c4d7a1883b048e6bf7f41b8c59c2b3270 (patch) | |
| tree | 52469f46085171c1bbc6e967bc430174a139cba7 /src | |
| parent | 005ef14949aacfc7a7af7a08bb67282f663b38ec (diff) | |
| download | Firmament-781e204c4d7a1883b048e6bf7f41b8c59c2b3270.tar.gz Firmament-781e204c4d7a1883b048e6bf7f41b8c59c2b3270.tar.bz2 Firmament-781e204c4d7a1883b048e6bf7f41b8c59c2b3270.zip | |
fix: player entities not rendering in item list
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/kotlin/gui/entity/EntityRenderer.kt | 4 | ||||
| -rw-r--r-- | src/main/kotlin/gui/entity/GuiPlayer.kt | 10 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/main/kotlin/gui/entity/EntityRenderer.kt b/src/main/kotlin/gui/entity/EntityRenderer.kt index b5e27f6..3e21710 100644 --- a/src/main/kotlin/gui/entity/EntityRenderer.kt +++ b/src/main/kotlin/gui/entity/EntityRenderer.kt @@ -203,7 +203,7 @@ object EntityRenderer { val hw = (x2 - x1) / 2 val hh = (y2 - y1) / 2 val targetYaw = atan(((centerX - mouseX) / hw)).toFloat() - val targetPitch = atan(((centerY - mouseY) / hh)).toFloat() + val targetPitch = atan(((centerY - mouseY) / hh - entity.standingEyeHeight * hh / 40)).toFloat() val rotateToFaceTheFront = Quaternionf().rotateZ(Math.PI.toFloat()) val rotateToFaceTheCamera = Quaternionf().rotateX(targetPitch * 20.0f * (Math.PI.toFloat() / 180)) rotateToFaceTheFront.mul(rotateToFaceTheCamera) @@ -218,7 +218,7 @@ object EntityRenderer { entity.headYaw = entity.yaw entity.lastHeadYaw = entity.yaw val vector3f = Vector3f(0.0f, (entity.height / 2.0f + bottomOffset).toFloat(), 0.0f) - InventoryScreen.drawEntity( + InventoryScreen.drawEntity( // TODO: fix multiple entities rendering the same entity context, x1, y1, x2, y2, diff --git a/src/main/kotlin/gui/entity/GuiPlayer.kt b/src/main/kotlin/gui/entity/GuiPlayer.kt index f728dbf..cc6580d 100644 --- a/src/main/kotlin/gui/entity/GuiPlayer.kt +++ b/src/main/kotlin/gui/entity/GuiPlayer.kt @@ -1,6 +1,7 @@ package moe.nea.firmament.gui.entity import com.mojang.authlib.GameProfile +import com.mojang.authlib.GameProfileRepository import java.util.UUID import net.minecraft.client.network.AbstractClientPlayerEntity import net.minecraft.client.util.DefaultSkinHelper @@ -16,13 +17,8 @@ import net.minecraft.world.World * @see moe.nea.firmament.init.EarlyRiser */ fun makeGuiPlayer(world: World): GuiPlayer { - val constructor = GuiPlayer::class.java.getDeclaredConstructor( - World::class.java, - BlockPos::class.java, - Float::class.javaPrimitiveType, - GameProfile::class.java - ) - val player = constructor.newInstance(world, BlockPos.ORIGIN, 0F, GameProfile(UUID.randomUUID(), "Linnea")) + val constructor = GuiPlayer::class.java.getDeclaredConstructor(ClientWorld::class.java, GameProfile::class.java) + val player = constructor.newInstance(world, GameProfile(UUID.randomUUID(), "Linnea")) player.postInit() return player } |
