Skip to content

Commit

Permalink
Implement idRelative
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenny-Hui committed Oct 27, 2024
1 parent f160560 commit c8a0de5
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/* From https://github.com/zbx1425/mtr-nte/blob/master/common/src/main/java/cn/zbx1425/mtrsteamloco/render/scripting/ScriptResourceUtil.java#L44 */

import com.lx862.jcm.mod.util.JCMLogger;
import org.apache.commons.lang3.NotImplementedException;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.Scriptable;
import org.mtr.mapping.holder.Identifier;
import org.mtr.mapping.mapper.ResourceManagerHelper;
import org.mtr.mapping.render.obj.ObjModelLoader;
import org.mtr.mod.Keys;

import java.awt.font.FontRenderContext;
Expand Down Expand Up @@ -60,15 +60,15 @@ public static Identifier idRelative(String textForm) {
if (scriptLocationStack.empty()) throw new RuntimeException(
"Cannot use idRelative in functions."
);
throw new NotImplementedException("idRelative is not implemented."); // TODO
// return ResourceUtil.resolveRelativePath(scriptLocationStack.peek(), textForm, null);
return ObjModelLoader.resolveRelativePath(scriptLocationStack.peek(), textForm, null);
}

public static Identifier idr(String textForm) {
if (scriptLocationStack.empty()) throw new RuntimeException(
"Cannot use idr in functions."
);
throw new NotImplementedException("idr is not implemented."); // TODO
// return ResourceUtil.resolveRelativePath(scriptLocationStack.peek(), textForm, null);
Identifier id = scriptLocationStack.peek();
return ObjModelLoader.resolveRelativePath(id, textForm, null);
}

private static final FontRenderContext FONT_CONTEXT = new FontRenderContext(new AffineTransform(), true, false);
Expand Down

0 comments on commit c8a0de5

Please sign in to comment.