summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/mixins/hooks
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-05-07 22:41:10 +0200
committerGitHub <noreply@github.com>2024-05-07 22:41:10 +0200
commit912c8d8a8c9ad412b2f94827e09a9cf262e5b69a (patch)
tree39abdb48d61f5989210e6e73a1254b36992449f3 /src/main/java/at/hannibal2/skyhanni/mixins/hooks
parent50f3954a3c0e15eb18ae864bbd28e0b645aa9d1b (diff)
downloadskyhanni-912c8d8a8c9ad412b2f94827e09a9cf262e5b69a.tar.gz
skyhanni-912c8d8a8c9ad412b2f94827e09a9cf262e5b69a.tar.bz2
skyhanni-912c8d8a8c9ad412b2f94827e09a9cf262e5b69a.zip
Feature: Mining Commissions Blocks Color (#1701)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/mixins/hooks')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt35
1 files changed, 35 insertions, 0 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
new file mode 100644
index 000000000..5903136fa
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/mixins/hooks/BlockRendererDispatcherHook.kt
@@ -0,0 +1,35 @@
+package at.hannibal2.skyhanni.mixins.hooks
+
+import at.hannibal2.skyhanni.features.mining.MiningCommissionsBlocksColor
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import net.minecraft.block.state.IBlockState
+import net.minecraft.client.renderer.BlockRendererDispatcher
+import net.minecraft.client.resources.model.IBakedModel
+import net.minecraft.util.BlockPos
+import net.minecraft.world.IBlockAccess
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable
+
+fun modifyGetModelFromBlockState(
+ blockRendererDispatcher: BlockRendererDispatcher,
+ state: IBlockState?,
+ worldIn: IBlockAccess,
+ pos: BlockPos?,
+ cir: CallbackInfoReturnable<IBakedModel>,
+) {
+ if (state == null || pos == null) return
+ var returnState: IBlockState = state
+
+ 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)
+ }
+ }
+ }
+
+ if (returnState !== state) {
+ cir.returnValue = blockRendererDispatcher.blockModelShapes.getModelForState(returnState)
+ }
+}