diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-09-21 10:32:43 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-09-21 10:32:43 +0200 |
commit | f056eb5a458ae95dff2cdbd84217e491f72a3d06 (patch) | |
tree | 25abff74b164f49e88d736d0b49f52ccdf95e801 /src/main/java/at/hannibal2/skyhanni/mixins/hooks | |
parent | 1da7050a5b95e6e1cf0111c3a71b042168d3918e (diff) | |
download | skyhanni-f056eb5a458ae95dff2cdbd84217e491f72a3d06.tar.gz skyhanni-f056eb5a458ae95dff2cdbd84217e491f72a3d06.tar.bz2 skyhanni-f056eb5a458ae95dff2cdbd84217e491f72a3d06.zip |
MiningCommissionsBlocksColor.processState
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt | 21 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt | 28 |
2 files changed, 5 insertions, 44 deletions
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 f72d56739..cf4e4ba40 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt @@ -1,10 +1,6 @@ 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.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.block.state.IBlockState import net.minecraft.client.renderer.BlockRendererDispatcher @@ -21,24 +17,13 @@ fun modifyGetModelFromBlockState( pos: BlockPos?, cir: CallbackInfoReturnable<IBakedModel>, ) { - if (state == null || pos == null) return - var returnState: IBlockState = state + if (pos == null) return if (!LorenzUtils.inSkyBlock) return - 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") - } + val returnState = MiningCommissionsBlocksColor.processState(state) - if (returnState !== state) { + if (returnState != state) { cir.returnValue = blockRendererDispatcher.blockModelShapes.getModelForState(returnState) } } diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt index f930e1008..fe4619cf2 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt @@ -1,35 +1,11 @@ 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.test.command.ErrorManager import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.block.state.IBlockState -fun modifyConnectedTexturesBlockState(state: IBlockState): IBlockState { - if (state == null) return state - var returnState: IBlockState = state - +fun modifyConnectedTexturesBlockState(state: IBlockState?): IBlockState? { if (!LorenzUtils.inSkyBlock) return 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) { - - return returnState - } - return state + return MiningCommissionsBlocksColor.processState(state) } |