diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 13:06:41 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-19 13:06:41 +0100 |
commit | 7d090afad3c9fa3b1e1abb3308378d1acdcad369 (patch) | |
tree | a529ef10e9ffa0d734fe4c9ec46bd3deb3210b20 /src/main/java/at/hannibal2/skyhanni/features | |
parent | 71913ed849ea4c7ccc701092f4aa94945663fcf0 (diff) | |
download | skyhanni-7d090afad3c9fa3b1e1abb3308378d1acdcad369.tar.gz skyhanni-7d090afad3c9fa3b1e1abb3308378d1acdcad369.tar.bz2 skyhanni-7d090afad3c9fa3b1e1abb3308378d1acdcad369.zip |
Created getSBMonthByName and addGardenCropToList utils methods
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
3 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt index 37d2e1f18..3281bf39c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenAPI.kt @@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.PacketEvent import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUItems import net.minecraft.client.Minecraft import net.minecraft.item.ItemStack import net.minecraft.network.play.client.C09PacketHeldItemChange @@ -122,5 +123,18 @@ class GardenAPI { } return itemName } + + private fun getItemStackForCrop(crop: String): ItemStack { + val internalName = NEUItems.getInternalName(if (crop == "Mushroom") "Red Mushroom" else crop) + return NEUItems.getItemStack(internalName) + } + + fun addGardenCropToList(crop: String, list: MutableList<Any>) { + try { + list.add(getItemStackForCrop(crop)) + } catch (e: NullPointerException) { + e.printStackTrace() + } + } } }
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt index 1913406e8..c4e8bf484 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenCropMilestoneDisplay.kt @@ -5,7 +5,6 @@ import at.hannibal2.skyhanni.data.GardenCropMilestones import at.hannibal2.skyhanni.data.SendTitleHelper import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SoundUtils.playSound import at.hannibal2.skyhanni.utils.TimeUtils @@ -163,14 +162,7 @@ class GardenCropMilestoneDisplay { progressDisplay.add(Collections.singletonList("ยง6Crop Milestones")) val list = mutableListOf<Any>() - - try { - val internalName = NEUItems.getInternalName(if (it == "Mushroom") "Red Mushroom" else it) - val itemStack = NEUItems.getItemStack(internalName) - list.add(itemStack) - } catch (e: NullPointerException) { - e.printStackTrace() - } + GardenAPI.addGardenCropToList(it, list) list.add(it) progressDisplay.add(list) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt index c4da66bcc..d2b0a1138 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/JacobFarmingContestsInventory.kt @@ -75,14 +75,8 @@ class JacobFarmingContestsInventory { val day = matcher.group(2).toInt() val year = matcher.group(3).toInt() - var monthNr = 0 - for (i in 1..12) { - val monthName = SkyBlockTime.monthName(i) - if (month == monthName) { - monthNr = i - } - } - val time = SkyBlockTime(year, monthNr, day, 0, 0, 0) + val monthNr = LorenzUtils.getSBMonthByName(month) + val time = SkyBlockTime(year, monthNr, day) val toMillis = time.toMillis() val dayFormat = formatDay.format(toMillis) val startTimeFormat = formatTime.format(toMillis) |