diff options
author | CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> | 2023-06-28 08:13:53 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-28 00:13:53 +0200 |
commit | 76d967ce0435c55a9bc992e49b13df091553341d (patch) | |
tree | fd9c9e3fb3af13626e00c548821dd07f75558ecc /src/main/java/at/hannibal2/skyhanni/features | |
parent | cca6b12b872bee1f09a218771a08a86d30c9602c (diff) | |
download | skyhanni-76d967ce0435c55a9bc992e49b13df091553341d.tar.gz skyhanni-76d967ce0435c55a9bc992e49b13df091553341d.tar.bz2 skyhanni-76d967ce0435c55a9bc992e49b13df091553341d.zip |
Merge pull request #259
* fix crash, show neu warning
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt index 88a4a713c..b397d7c1d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenDeskInSBMenu.kt @@ -10,6 +10,8 @@ import io.github.moulberry.notenoughupdates.events.ReplaceItemEvent import io.github.moulberry.notenoughupdates.events.SlotClickEvent import io.github.moulberry.notenoughupdates.util.Utils import net.minecraft.client.player.inventory.ContainerLocalMenu +import net.minecraft.init.Blocks +import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -19,11 +21,14 @@ class GardenDeskInSBMenu { private var showItem = false private val item by lazy { - val neuItem = NEUItems.getItemStack("DOUBLE_PLANT") - Utils.createItemStack(neuItem.item, "§bDesk", "§7Click here to", "§7run §e/desk") + var neuItem = NEUItems.getItemStackOrNull("DOUBLE_PLANT") + if (neuItem == null) { + neuItem = ItemStack(Blocks.double_plant) + Utils.showOutdatedRepoNotification() + } + Utils.createItemStack(neuItem!!.item, "§bDesk", "§7Click here to", "§7run §e/desk") } - @SubscribeEvent fun onInventoryOpen(event: InventoryOpenEvent) { showItem = GardenAPI.inGarden() && config.deskInSkyBlockMenu && event.inventoryName == "SkyBlock Menu" @@ -44,7 +49,7 @@ class GardenDeskInSBMenu { @SubscribeEvent(priority = EventPriority.HIGH) fun onStackClick(event: SlotClickEvent) { if (showItem && event.slotId == 10) { - event.isCanceled = true + event.isCanceled = true LorenzUtils.sendCommandToServer("desk") } } |