diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt index ec98aa655..5cfcd881d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetCandyUsedDisplay.kt @@ -4,25 +4,10 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.GuiRenderItemEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetCandyUsed -import com.google.common.cache.CacheBuilder import net.minecraft.client.renderer.GlStateManager -import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -import java.util.concurrent.TimeUnit class PetCandyUsedDisplay { - private var cache = - CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.SECONDS).build<ItemStack, Int>() - - private fun getCachedPetCandyUsed(stack: ItemStack): Int? { - cache.getIfPresent(stack)?.let { - if (it == -1) return null - return it - } - val candyUsed = stack.getPetCandyUsed() - cache.put(stack, candyUsed ?: -1) - return candyUsed - } @SubscribeEvent fun onRenderItemOverlayPost(event: GuiRenderItemEvent.RenderOverlayEvent.GuiRenderItemPost) { @@ -31,8 +16,7 @@ class PetCandyUsedDisplay { if (!SkyHanniMod.feature.misc.petCandyUsed) return - val petCandyUsed = getCachedPetCandyUsed(stack) ?: return -// val petCandyUsed = stack.getPetCandyUsed() ?: return + val petCandyUsed = stack.getPetCandyUsed() ?: return if (petCandyUsed == 0) return val stackTip = "§c$petCandyUsed" |