From bfe43b7ebffab551740d32cf919db27504d27ffb Mon Sep 17 00:00:00 2001 From: Empa <42304516+ItsEmpa@users.noreply.github.com> Date: Sat, 15 Jun 2024 22:12:24 +0200 Subject: Feature: Mineshaft Pity Display + OreMinedEvent (#1655) Co-authored-by: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com> Co-authored-by: Thunderblade73 Co-authored-by: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/mixins') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt index 3f8f803b0..2d15d3cb7 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt @@ -1,6 +1,9 @@ package at.hannibal2.skyhanni.mixins.hooks 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.utils.LorenzUtils import net.minecraft.block.state.IBlockState import net.minecraft.client.renderer.BlockRendererDispatcher @@ -23,10 +26,10 @@ fun modifyGetModelFromBlockState( if (!LorenzUtils.inSkyBlock) return if (MiningCommissionsBlocksColor.enabled && MiningCommissionsBlocksColor.active) { - for (block in MiningCommissionsBlocksColor.MiningBlock.entries) { - if (block.checkIsland() && block.onCheck(state)) { - returnState = block.onColor(state, block.highlight) - } + returnState = replaceBlocksMapCache.getOrPut(state) { + MiningCommissionsBlocksColor.CommissionBlock.entries.firstOrNull { + state.isOreType(it.oreType) + }?.onColor(state) ?: state } } -- cgit