User: kilip1000 Date: 07 Sep 26 16:58 Revision: c6f0217256b87cc10966c66f6d04d239ebd0d0ee Summary: add MapColor preview-color gutter icons (#2627) * add MapColor gutter icons * Manually apply license header * fix: Manually apply license header for MapColorUtil.kt TeamCity URL: http://ci.mcdev.io:80/viewModification.html?tab=vcsModificationFiles&modId=10632&personal=false Index: src/main/kotlin/insight/MapColorLineMarkerProvider.kt =================================================================== --- src/main/kotlin/insight/MapColorLineMarkerProvider.kt (revision c6f0217256b87cc10966c66f6d04d239ebd0d0ee) +++ src/main/kotlin/insight/MapColorLineMarkerProvider.kt (revision c6f0217256b87cc10966c66f6d04d239ebd0d0ee) @@ -0,0 +1,29 @@ +/* + * Minecraft Development for IntelliJ + * + * https://mcdev.io/ + * + * Copyright (C) 2026 minecraft-dev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, version 3.0 only. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.demonwav.mcdev.insight + +import com.intellij.psi.PsiElement +import java.awt.Color +import org.jetbrains.uast.UElement + +class MapColorLineMarkerProvider : ColorLineMarkerProvider.CommonLineMarkerProvider() { + override fun findColor(element:PsiElement): Pair? = element.findMapColor() +} Index: src/main/kotlin/insight/MapColorUtil.kt =================================================================== --- src/main/kotlin/insight/MapColorUtil.kt (revision c6f0217256b87cc10966c66f6d04d239ebd0d0ee) +++ src/main/kotlin/insight/MapColorUtil.kt (revision c6f0217256b87cc10966c66f6d04d239ebd0d0ee) @@ -0,0 +1,47 @@ +/* + * Minecraft Development for IntelliJ + * + * https://mcdev.io/ + * + * Copyright (C) 2026 minecraft-dev + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, version 3.0 only. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program. If not, see . + */ + +package com.demonwav.mcdev.insight + +import com.intellij.psi.PsiElement +import java.awt.Color +import org.jetbrains.uast.UCallExpression +import org.jetbrains.uast.UElement +import org.jetbrains.uast.UIdentifier +import org.jetbrains.uast.getParentOfType +import org.jetbrains.uast.toUElementOfType + +fun PsiElement.findMapColor(): Pair? { + val identifier = this.toUElementOfType() + ?: return null + + val call = identifier.getParentOfType() + ?: return null + + if (call.resolve()?.containingClass?.qualifiedName != "net.minecraft.world.level.material.MapColor") { + return null + } + + val params = call.valueArguments + val argb = (params.getOrNull(1)?.evaluate() as? Number)?.toInt() ?: return null + @Suppress("UseJBColor") + return Color(argb, false) to call +} + Index: src/main/resources/META-INF/plugin.xml =================================================================== --- src/main/resources/META-INF/plugin.xml (revision 156fe70647ee7103872cad1279bb194d6ab77e10) +++ src/main/resources/META-INF/plugin.xml (revision c6f0217256b87cc10966c66f6d04d239ebd0d0ee) @@ -372,6 +372,8 @@ implementationClass="com.demonwav.mcdev.insight.ColorLineMarkerProvider"/> +