diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2024-09-21 18:31:34 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-21 10:31:34 +0200 |
commit | 1da7050a5b95e6e1cf0111c3a71b042168d3918e (patch) | |
tree | eedb1c8091ca0b5f5f60033386919f2c91840b51 /src/main/java/at/hannibal2/skyhanni/mixins/hooks | |
parent | 1062c413cc17b0e99ca527b33568edf71642cab5 (diff) | |
download | skyhanni-1da7050a5b95e6e1cf0111c3a71b042168d3918e.tar.gz skyhanni-1da7050a5b95e6e1cf0111c3a71b042168d3918e.tar.bz2 skyhanni-1da7050a5b95e6e1cf0111c3a71b042168d3918e.zip |
Make Mining Commissions Blocks Colour actually work with connected textures instead of just turning them off 🙂 (#2559)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt new file mode 100644 index 000000000..f930e1008 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/OptifineConnectedTexturesHook.kt @@ -0,0 +1,35 @@ +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 + + 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 +} + |