Skip to content

Commit

Permalink
fix(geckolibcore): readouts not working
Browse files Browse the repository at this point in the history
  • Loading branch information
bernie-g committed Sep 12, 2024
1 parent 5560a0e commit 8e5530f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/main/java/com/eliotlash/molang/utils/ParserUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

public class ParserUtils {
public static Expr.Variable createVariableFromString(String string) {
String[] split = string.split("\\.", 2);
if (split.length == 1) {
return new Expr.Variable(null, split[0]);
if (VariableFlavor.parse(string) == null) {
return new Expr.Variable(null, string);
} else {
return new Expr.Variable(VariableFlavor.parse(split[0]), split[1]);
return new Expr.Variable(VariableFlavor.parse(string), null);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ public RuntimeVariable getCachedVariable(VariableFlavor flavor, String var) {

public RuntimeVariable parseRuntimeVariable(VariableFlavor flavor, String variableName, Expr.Access access) {
RuntimeVariable runtimeVariable;
if (flavor != null) {
if (flavor != null && variableName != null) {
runtimeVariable = new RuntimeVariable(flavor, variableName);
} else if (flavor != null) {
runtimeVariable = new RuntimeVariable(flavor, access.member());
} else {
runtimeVariable = new RuntimeVariable(null, variableName);
}
Expand Down

0 comments on commit 8e5530f

Please sign in to comment.