From a403ad6d485d55e10da244e3ac824fc311f103cc Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 17 Apr 2023 17:14:07 +0200 Subject: Added click support for the missing visitor items display while inside signs (fill the item amount into the bazaar) --- .../garden/visitor/GardenVisitorFeatures.kt | 23 +++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index aa6aaba5c..7f7b4967e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.garden.visitor import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.TitleUtils import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.features.garden.CropType @@ -17,13 +18,16 @@ import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.RenderUtils.drawString import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.removeColor +import at.hannibal2.skyhanni.utils.renderables.Renderable import io.github.moulberry.notenoughupdates.events.SlotClickEvent import io.github.moulberry.notenoughupdates.util.SBInfo import net.minecraft.client.Minecraft +import net.minecraft.client.gui.inventory.GuiEditSign import net.minecraft.entity.Entity import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand import net.minecraft.network.play.client.C02PacketUseEntity +import net.minecraftforge.client.event.GuiScreenEvent.DrawScreenEvent import net.minecraftforge.client.event.RenderLivingEvent import net.minecraftforge.client.event.RenderWorldLastEvent import net.minecraftforge.event.entity.player.ItemTooltipEvent @@ -132,7 +136,10 @@ class GardenVisitorFeatures { val list = mutableListOf() list.add(" §7- ") list.add(itemStack) - list.add("$name §8x${amount.addSeparators()}") + + list.add(Renderable.link("$name §8x${amount.addSeparators()}") { + LorenzUtils.setTextIntoSign("$amount") + }) if (config.visitorNeedsShowPrice) { val price = NEUItems.getPrice(internalName) * amount @@ -537,6 +544,20 @@ class GardenVisitorFeatures { lastClickedNpc = entityId } + @SubscribeEvent + fun onRenderInSigns(event: DrawScreenEvent.Post) { + if (!GardenAPI.inGarden()) return + if (!config.visitorNeedsDisplay) return + val gui = event.gui + if (gui !is GuiEditSign) return + + if (config.visitorNeedsOnlyWhenClose && !GardenAPI.onBarnPlot) return + + if (!GardenAPI.hideExtraGuis()) { + config.visitorNeedsPos.renderStringsAndItems(display, posLabel = "Visitor Items Needed") + } + } + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent) { if (!GardenAPI.inGarden()) return -- cgit