aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-24 17:55:12 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-02-24 17:55:12 +0100
commit1ebc88de808bcfa107f640cc2ea9e3cd17b5cedf (patch)
treefc90194f7cf16f4384664822dd073cf6d1f816d6 /src/main
parent48f5a5599fe74f42c65000e82dd0ef116b07f35c (diff)
downloadskyhanni-1ebc88de808bcfa107f640cc2ea9e3cd17b5cedf.tar.gz
skyhanni-1ebc88de808bcfa107f640cc2ea9e3cd17b5cedf.tar.bz2
skyhanni-1ebc88de808bcfa107f640cc2ea9e3cd17b5cedf.zip
Showing item icon in visitor item need list.
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt9
2 files changed, 18 insertions, 10 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
index b1f266953..7cae1bf81 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenVisitorFeatures.kt
@@ -8,7 +8,7 @@ import at.hannibal2.skyhanni.mixins.hooks.RenderLivingEntityHelper
import at.hannibal2.skyhanni.utils.*
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
-import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
+import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import net.minecraft.client.Minecraft
import net.minecraft.entity.EntityLivingBase
@@ -16,11 +16,12 @@ import net.minecraft.network.play.client.C02PacketUseEntity
import net.minecraftforge.event.entity.player.ItemTooltipEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import net.minecraftforge.fml.common.gameevent.TickEvent
+import java.util.*
class GardenVisitorFeatures {
private val visitors = mutableMapOf<String, Visitor>()
- private val display = mutableListOf<String>()
+ private val display = mutableListOf<List<Any>>()
private var lastClickedNpc = 0
private var nearby = false
@@ -79,20 +80,22 @@ class GardenVisitorFeatures {
}
}
if (requiredItems.isNotEmpty()) {
- display.add("Visitor items needed:")
+ display.add(Collections.singletonList("§7Visitor items needed:"))
for ((name, amount) in requiredItems) {
- display.add(" -$name §8x$amount")
+ val internalName = NEUItems.getInternalName(name)
+ val itemStack = NEUItems.getItemStack(internalName)
+ display.add(listOf(" §7- ", itemStack, "$name §8x$amount"))
}
}
if (newVisitors.isNotEmpty()) {
if (requiredItems.isNotEmpty()) {
- display.add("")
+ display.add(Collections.singletonList(""))
}
val amount = newVisitors.size
val visitorLabel = if (amount == 1) "visitor" else "visitors"
- display.add("$amount new $visitorLabel:")
+ display.add(Collections.singletonList("§e$amount §7new $visitorLabel:"))
for (visitor in newVisitors) {
- display.add(" -$visitor")
+ display.add(Collections.singletonList(" §7- $visitor"))
}
}
}
@@ -248,7 +251,7 @@ class GardenVisitorFeatures {
if (!nearby) return
}
- SkyHanniMod.feature.garden.visitorNeedsPos.renderStrings(display)
+ SkyHanniMod.feature.garden.visitorNeedsPos.renderStringsAndItems(display)
}
class Visitor(val entityId: Int, val items: MutableMap<String, Int> = mutableMapOf())
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index c826ac1f6..dec6964e2 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -41,9 +41,14 @@ object NEUItems {
fun ItemStack.renderOnScreen(x: Float, y: Float) {
GlStateManager.pushMatrix()
- GlStateManager.translate(x, y, 0f)
+ val isSkull = item === Items.skull
+ if (isSkull) {
+ GlStateManager.translate(x - 2, y - 2, 0f)
+ } else {
+ GlStateManager.translate(x, y, 0f)
+ }
- val scale = if (item === Items.skull) 0.8f else 0.6f
+ val scale = if (isSkull) 0.8f else 0.6f
GlStateManager.scale(scale, scale, 1f)
Utils.drawItemStack(this, 0, 0)
GlStateManager.popMatrix()