aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-03 15:58:24 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-03-03 15:58:24 +0100
commit50b689c7fec6de695ca41b8d0b9776b3c0a1af5d (patch)
treed679e10b5e00a835d74ffeb005a42b9d3aec9e6d /src
parent6cb84884eaab665c01112467799088c2c9eac6c0 (diff)
downloadskyhanni-50b689c7fec6de695ca41b8d0b9776b3c0a1af5d.tar.gz
skyhanni-50b689c7fec6de695ca41b8d0b9776b3c0a1af5d.tar.bz2
skyhanni-50b689c7fec6de695ca41b8d0b9776b3c0a1af5d.zip
Fixed crash while rendering items.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
index 6d99f23a1..24c7e9e1f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/RenderUtils.kt
@@ -471,22 +471,27 @@ 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) {
if (Minecraft.getMinecraft().gameSettings.keyBindPlayerList.isKeyDown) return
if (list.isEmpty()) return
var offsetY = 0
+ // TODO remove toMutableList
for (line in list.toMutableList()) {
renderLine(line, offsetY)
offsetY += 10 + extraSpace + 2
}
}
- private fun Position.renderLine(line: List<Any>, offsetY: Int) {
+ private fun Position.renderLine(line: List<Any?>, offsetY: Int) {
val renderer = Minecraft.getMinecraft().fontRendererObj
val resolution = ScaledResolution(Minecraft.getMinecraft())
var offsetX = 0
for (any in line) {
+ if (any == null) {
+ offsetX += 12
+ continue
+ }
if (any is String) {
renderString(any, offsetX, offsetY, center = false)
val width = renderer.getStringWidth(any.removeColor())