Fixed autocomplete item package color for interfaces/enums

This commit is contained in:
bigguy345 committed 2026-03-13 20:47:54 +02:00
1 parent f25b9164d0
commit 81b3d1c2d3
3 files changed
+7

No files matched your search

@@ -639,6 +639,9 @@ public class AutocompleteMenu extends Gui {
private void drawTypeLabel(AutocompleteItem item, String typeLabel, int x, int y, int typeColor, TypeInfo typeInfo) {
if (typeInfo == null || item.getKind() == AutocompleteItem.Kind.CLASS) { //draw package on right
// draw default package color instead of interface/enum colors
if (typeInfo != null && !typeInfo.isClass())
typeColor = TokenType.getPackageColor();
drawSimpleTypeWithArraySuffix(typeLabel, x, y, typeColor);
return;
}
@@ -112,6 +112,9 @@ public enum TokenType {
return getByType(typeInfo).getHexColor();
}
public static int getPackageColor(){
return IMPORTED_CLASS.getHexColor();
}
/**
* Convert this token type to a Minecraft color code character.
* Used for backward compatibility with the existing rendering system.
@@ -604,6 +604,7 @@ public class TypeInfo {
public boolean isInnerClass() { return enclosingType != null; }
public boolean isInterface() {return kind == Kind.INTERFACE;}
public boolean isEnum() {return kind == Kind.ENUM;}
public boolean isClass() {return kind == Kind.CLASS;}
public boolean isPrimitive() {return this.isPrimitive || javaClass != null && javaClass.isPrimitive();}
private TypeInfo setPrimitive(boolean value) { this.isPrimitive = value; return this;}