From cd926283b3308bcb3926c29026ffabc252abc492 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 3 Oct 2018 07:48:26 -0700 Subject: [PATCH] avoid synthetic lambda creation --- src/main/java/baritone/utils/ToolSet.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 62115f24..962ffb08 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -67,7 +67,14 @@ public class ToolSet implements Helper { * @return how long it would take in ticks */ public double getStrVsBlock(IBlockState state) { - return this.breakStrengthCache.computeIfAbsent(state.getBlock(), b -> calculateStrVsBlock(getBestSlot(state), state)); + Double strength = this.breakStrengthCache.get(state.getBlock()); + if (strength != null) { + // the function will take this path >99% of the time + return strength; + } + double str = calculateStrVsBlock(getBestSlot(state), state); + this.breakStrengthCache.put(state.getBlock(), str); + return str; } /**