diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 15:06:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 15:06:10 +0100 |
commit | c5affe08dafdd45c38ae4b8dcdc1087a624e1b38 (patch) | |
tree | 0b96059daee7a96c3fd4f7df515f4f489efb245f /src/main/java/at/hannibal2 | |
parent | 1eb058d6800f9e01ac7c7696254ef955e60c80c4 (diff) | |
download | skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.tar.gz skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.tar.bz2 skyhanni-c5affe08dafdd45c38ae4b8dcdc1087a624e1b38.zip |
Added item scaling to farming contest timer
Diffstat (limited to 'src/main/java/at/hannibal2')
3 files changed, 28 insertions, 19 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index b2edd442d..dbf5ff5c8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -161,19 +161,19 @@ class GardenNextJacobContest { nextContest: FarmingContest, list: MutableList<Any>, ): MutableList<Any> { - for (crop in nextContest.crops) { - GardenAPI.addGardenCropToList(crop, list) - list.add(" ") - } var duration = nextContest.endTime - System.currentTimeMillis() if (duration < contestDuration) { - list.add("§aActive ") + list.add("§aActive: ") } else { - list.add("§eNext ") + list.add("§eNext: ") duration -= contestDuration } + for (crop in nextContest.crops) { + list.add(" ") + GardenAPI.addGardenCropToList(crop, list) + } val format = TimeUtils.formatDuration(duration) - list.add("§b$format ") + list.add("§7(§b$format§7)") return list } @@ -182,7 +182,7 @@ class GardenNextJacobContest { fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) { if (!isEnabled()) return - config.nextJacobContestPos.renderSingleLineWithItems(display) + config.nextJacobContestPos.renderSingleLineWithItems(display, 1.7) } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 72bffdc46..388ea8a08 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -70,17 +70,26 @@ object NEUItems { fun isVanillaItem(item: ItemStack) = manager.auctionManager.isVanillaItem(item.getInternalName()) - fun ItemStack.renderOnScreen(x: Float, y: Float) { + fun ItemStack.renderOnScreen(x: Float, y: Float, scaleMultiplier: Double = 1.0) { GlStateManager.pushMatrix() val isSkull = item === Items.skull + + val baseScale = (if (isSkull) 0.8f else 0.6f) + val finalScale = baseScale * scaleMultiplier + val diff = ((finalScale - baseScale) * 10).toFloat() + + val translateX: Float + val translateY: Float if (isSkull) { - GlStateManager.translate(x - 2, y - 2, 0f) + translateX = x - 2 - diff + translateY = y - 2 - diff } else { - GlStateManager.translate(x, y, 0f) + translateX = x - diff + translateY = y - diff } - val scale = if (isSkull) 0.8f else 0.6f - GlStateManager.scale(scale, scale, 0f) + GlStateManager.translate(translateX, translateY, 0f) + GlStateManager.scale(finalScale, finalScale, 0.0) drawItemStack(this) GlStateManager.popMatrix() } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt index e5c06a6a8..7098150ea 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt @@ -469,14 +469,14 @@ object RenderUtils { * Accepts a list of lines to print. * Each line is a list of things to print. Can print String or ItemStack objects. */ - fun Position.renderStringsAndItems(list: List<List<Any?>>, extraSpace: Int = 0) { + fun Position.renderStringsAndItems(list: List<List<Any?>>, extraSpace: Int = 0, itemScale: Double = 1.0) { if (list.isEmpty()) return var offsetY = 0 // TODO remove toMutableList try { for (line in list.toMutableList()) { - renderLine(line, offsetY) + renderLine(line, offsetY, itemScale) offsetY += 10 + extraSpace + 2 } } catch (e: NullPointerException) { @@ -496,12 +496,12 @@ object RenderUtils { * Accepts a single line to print. * This line is a list of things to print. Can print String or ItemStack objects. */ - fun Position.renderSingleLineWithItems(list: List<Any?>) { + fun Position.renderSingleLineWithItems(list: List<Any?>, itemScale: Double = 1.0) { if (list.isEmpty()) return - renderLine(list, 0) + renderLine(list, 0, itemScale) } - private fun Position.renderLine(line: List<Any?>, offsetY: Int) { + private fun Position.renderLine(line: List<Any?>, offsetY: Int, itemScale: Double = 1.0) { val renderer = Minecraft.getMinecraft().fontRendererObj val resolution = ScaledResolution(Minecraft.getMinecraft()) var offsetX = 0 @@ -519,7 +519,7 @@ object RenderUtils { val isX = getAbsX(resolution, 0) + offsetX val isY = getAbsY(resolution, 0) + offsetY - any.renderOnScreen(isX.toFloat(), isY.toFloat()) + any.renderOnScreen(isX.toFloat(), isY.toFloat(), itemScale) offsetX += 12 } } |