blob: 7622ac4962f3ac8725e561f2ec28e184961a4617 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
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
// Taken and modified from Skytils
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)
}
}
|