mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-13 21:54:08 +00:00
Drawn static/final denoters to AutocompleteItems
This commit is contained in:
1 parent
461e45c2eb
commit
db3a7de926
3 files changed
+43
-10
No files matched your search
@@ -396,6 +396,30 @@ public class AutocompleteItem implements Comparable<AutocompleteItem> {
|
||||
public int getMatchScore() { return matchScore; }
|
||||
public int[] getMatchIndices() { return matchIndices; }
|
||||
|
||||
/**
|
||||
* Check if this item represents a static member.
|
||||
*/
|
||||
public boolean isStatic() {
|
||||
if (sourceData instanceof MethodInfo) {
|
||||
return ((MethodInfo) sourceData).isStatic();
|
||||
} else if (sourceData instanceof FieldInfo) {
|
||||
return ((FieldInfo) sourceData).isStatic();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this item represents a final member.
|
||||
*/
|
||||
public boolean isFinal() {
|
||||
if (sourceData instanceof MethodInfo) {
|
||||
return ((MethodInfo) sourceData).isFinal();
|
||||
} else if (sourceData instanceof FieldInfo) {
|
||||
return ((FieldInfo) sourceData).isFinal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon identifier based on kind.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import noppes.npcs.client.gui.util.script.interpreter.token.TokenType;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -294,6 +295,22 @@ public class AutocompleteMenu extends Gui {
|
||||
|
||||
int textX = itemX;
|
||||
int textY = itemY + (ITEM_HEIGHT - font.FONT_HEIGHT) / 2;
|
||||
|
||||
// Draw modifier text (static/final) if present
|
||||
boolean isStatic = item.isStatic();
|
||||
boolean isFinal = item.isFinal();
|
||||
if (isStatic || isFinal) {
|
||||
GL11.glPushMatrix();
|
||||
float scale = 0.5f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
int col = TokenType.MODIFIER.getHexColor();
|
||||
|
||||
if (isStatic)
|
||||
font.drawString("s", (int) (textX / scale), (int) (textY / scale), col);
|
||||
if (isFinal)
|
||||
font.drawString("f", (int) (textX / scale), (int) (textY / scale) + 10, col);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
// Draw icon
|
||||
String icon = item.getIconId();
|
||||
|
||||
+2
-10
@@ -405,16 +405,8 @@ public class JavaAutocompleteProvider implements AutocompleteProvider {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the item is a static member
|
||||
Object sourceData = item.getSourceData();
|
||||
boolean isStatic = false;
|
||||
|
||||
if (sourceData instanceof MethodInfo) {
|
||||
isStatic = ((MethodInfo) sourceData).isStatic();
|
||||
} else if (sourceData instanceof FieldInfo) {
|
||||
isStatic = ((FieldInfo) sourceData).isStatic();
|
||||
}
|
||||
|
||||
boolean isStatic = item.isStatic();
|
||||
|
||||
// Apply penalty to static members in instance context
|
||||
if (isStatic) {
|
||||
int matchScore = item.getMatchScore();
|
||||
|
||||
Reference in new issue
Block a user