more like open good luck

This commit is contained in:
gamma-delta 2021-12-26 17:35:55 -06:00
parent c5c38f7cd8
commit 7794eab704

View file

@ -47,6 +47,7 @@ class GuiSpellcasting : Screen(TextComponent("")) {
if (anchor != null) { if (anchor != null) {
val mouse = Vec2(pMouseX.toFloat(), pMouseY.toFloat()) val mouse = Vec2(pMouseX.toFloat(), pMouseY.toFloat())
if (anchor.distanceToSqr(mouse) >= this.hexSize() * this.hexSize()) { if (anchor.distanceToSqr(mouse) >= this.hexSize() * this.hexSize()) {
HexMod.LOGGER.info("($pMouseX, $pMouseY) was sufficiently far from (${anchor.x}, ${anchor.y})")
val delta = mouse.add(anchor.negated()) val delta = mouse.add(anchor.negated())
val angle = atan2(delta.y, delta.x) val angle = atan2(delta.y, delta.x)
// 0 is right, increases clockwise(?) // 0 is right, increases clockwise(?)
@ -66,7 +67,7 @@ class GuiSpellcasting : Screen(TextComponent("")) {
val success = ds.wipPattern.tryAppendDir(newdir) val success = ds.wipPattern.tryAppendDir(newdir)
if (success) { if (success) {
ds.current = idealNextLoc ds.current = idealNextLoc
HexMod.LOGGER.info("Added to pattern: ${ds.wipPattern} ; New current pos: ${ds.current}") HexMod.LOGGER.info("Added to pattern: ${ds.wipPattern} ; New current pos: (${ds.current.x}, ${ds.current.y})")
} }
} }
} }
@ -103,7 +104,7 @@ class GuiSpellcasting : Screen(TextComponent("")) {
override fun render(poseStack: PoseStack, pMouseX: Int, pMouseY: Int, pPartialTick: Float) { override fun render(poseStack: PoseStack, pMouseX: Int, pMouseY: Int, pPartialTick: Float) {
super.render(poseStack, pMouseX, pMouseY, pPartialTick) super.render(poseStack, pMouseX, pMouseY, pPartialTick)
// oh god // they spell it wrong at mojang lmao
val tess = Tesselator.getInstance() val tess = Tesselator.getInstance()
val buf = tess.builder val buf = tess.builder
@ -116,7 +117,7 @@ class GuiSpellcasting : Screen(TextComponent("")) {
val pix = this.coordToPx(coord, origin) val pix = this.coordToPx(coord, origin)
buf.vertex(pix.x.toDouble(), pix.y.toDouble(), 0.0).color(127, 127, 255, 255).endVertex() buf.vertex(pix.x.toDouble(), pix.y.toDouble(), 0.0).color(127, 127, 255, 255).endVertex()
} }
buf.end() tess.end()
} }
// Now draw the currently WIP pattern // Now draw the currently WIP pattern
@ -135,11 +136,9 @@ class GuiSpellcasting : Screen(TextComponent("")) {
} }
buf.vertex(pMouseX.toDouble(), pMouseY.toDouble(), 0.0).color(240, 240, 255, 255).endVertex() buf.vertex(pMouseX.toDouble(), pMouseY.toDouble(), 0.0).color(240, 240, 255, 255).endVertex()
buf.end()
}
tess.end() tess.end()
} }
}
// why the hell is this default true // why the hell is this default true
override fun isPauseScreen(): Boolean = false override fun isPauseScreen(): Boolean = false
@ -152,7 +151,7 @@ class GuiSpellcasting : Screen(TextComponent("")) {
origin.add( origin.add(
Vec2( Vec2(
sqrt(3.0f) * coord.q.toFloat() + sqrt(3.0f) / 2.0f * coord.r.toFloat(), sqrt(3.0f) * coord.q.toFloat() + sqrt(3.0f) / 2.0f * coord.r.toFloat(),
1.5f * coord.r -1.5f * coord.r
).scale(this.hexSize()) ).scale(this.hexSize())
) )