Skip to content

Commit

Permalink
Fix: Mining Crash workaround (#2354)
Browse files Browse the repository at this point in the history
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
  • Loading branch information
hannibal002 and hannibal002 authored Aug 16, 2024
1 parent 24cbfa2 commit d524fe1
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.features.mining.MiningCommissionsBlocksColor
import at.hannibal2.skyhanni.features.mining.MiningCommissionsBlocksColor.CommissionBlock.Companion.onColor
import at.hannibal2.skyhanni.features.mining.MiningCommissionsBlocksColor.replaceBlocksMapCache
import at.hannibal2.skyhanni.features.mining.OreType.Companion.isOreType
import at.hannibal2.skyhanni.test.command.ErrorManager
import at.hannibal2.skyhanni.utils.LorenzUtils
import net.minecraft.block.state.IBlockState
import net.minecraft.client.renderer.BlockRendererDispatcher
Expand All @@ -25,12 +26,16 @@ fun modifyGetModelFromBlockState(

if (!LorenzUtils.inSkyBlock) return

if (MiningCommissionsBlocksColor.enabled && MiningCommissionsBlocksColor.active) {
returnState = replaceBlocksMapCache.getOrPut(state) {
MiningCommissionsBlocksColor.CommissionBlock.entries.firstOrNull {
state.isOreType(it.oreType)
}?.onColor(state) ?: state
try {
if (MiningCommissionsBlocksColor.enabled && MiningCommissionsBlocksColor.active) {
returnState = replaceBlocksMapCache.getOrPut(state) {
MiningCommissionsBlocksColor.CommissionBlock.entries.firstOrNull {
state.isOreType(it.oreType)
}?.onColor(state) ?: state
}
}
} catch (e: Exception) {
ErrorManager.logErrorWithData(e, "Error in MiningCommissionsBlocksColor")
}

if (returnState !== state) {
Expand Down

0 comments on commit d524fe1

Please sign in to comment.