From ebbe80b9d15a4949eb35c68bbc82173d52c8def4 Mon Sep 17 00:00:00 2001 From: gamma-delta <29877714+gamma-delta@users.noreply.github.com> Date: Sun, 8 May 2022 14:09:09 -0500 Subject: [PATCH] you can no longer cheese the spell gui wuth a really thin window --- .../at/petrak/hexcasting/client/gui/GuiSpellcasting.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt index 45b4478c..f0ac99f8 100644 --- a/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt +++ b/Common/src/main/java/at/petrak/hexcasting/client/gui/GuiSpellcasting.kt @@ -9,7 +9,6 @@ import at.petrak.hexcasting.api.spell.math.HexCoord import at.petrak.hexcasting.api.spell.math.HexDir import at.petrak.hexcasting.api.spell.math.HexPattern import at.petrak.hexcasting.api.utils.HexUtils -import at.petrak.hexcasting.api.utils.HexUtils.TAU import at.petrak.hexcasting.client.RenderLib import at.petrak.hexcasting.client.sound.GridSoundInstance import at.petrak.hexcasting.common.items.ItemSpellbook @@ -32,6 +31,7 @@ import net.minecraft.world.InteractionHand import net.minecraft.world.phys.Vec2 import kotlin.math.atan2 import kotlin.math.roundToInt +import kotlin.math.sqrt class GuiSpellcasting( private val handOpenedWith: InteractionHand, @@ -240,7 +240,7 @@ class GuiSpellcasting( MsgShiftScrollSyn( otherHand, pDelta, - Screen.hasControlDown() + hasControlDown() ) ) @@ -352,7 +352,11 @@ class GuiSpellcasting( fun hexSize(): Float { val hasLens = Minecraft.getInstance().player!! .getItemInHand(HexUtils.OtherHand(this.handOpenedWith)).`is`(HexItems.SCRYING_LENS) - return this.width.toFloat() / if (hasLens) 48.0f else 32.0f + + // Originally, we allowed 32 dots across. Assuming a 1920x1080 screen this allowed like 500-odd area. + // Let's be generous and give them 512. + val baseScale = sqrt(this.width.toDouble() * this.height / 512.0) + return baseScale.toFloat() * if (hasLens) 0.75f else 1f } fun coordsOffset(): Vec2 = Vec2(this.width.toFloat() * 0.5f, this.height.toFloat() * 0.5f)