Skip to content

Commit 768be0e

Browse files
committed
explicitly declare lcl has parent loader
1 parent 796659a commit 768be0e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/java/com/cleanroommc/groovyscript/sandbox/GroovySandbox.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import groovy.util.ResourceException;
1212
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
1313
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
14+
import net.minecraft.launchwrapper.Launch;
1415
import org.codehaus.groovy.control.CompilerConfiguration;
1516
import org.codehaus.groovy.runtime.InvokerHelper;
1617
import org.jetbrains.annotations.ApiStatus;
@@ -82,7 +83,7 @@ protected void stopRunning() {
8283
}
8384

8485
protected GroovyScriptEngine createScriptEngine() {
85-
GroovyScriptEngine engine = new GroovyScriptEngine(this.scriptEnvironment);
86+
GroovyScriptEngine engine = new GroovyScriptEngine(this.scriptEnvironment, Launch.classLoader);
8687
CompilerConfiguration config = new CompilerConfiguration(CompilerConfiguration.DEFAULT);
8788
config.setSourceEncoding("UTF-8");
8889
engine.setConfig(config);
@@ -103,11 +104,11 @@ public void load() throws Exception {
103104
Binding binding = createBindings();
104105
Set<File> executedClasses = new ObjectOpenHashSet<>();
105106

106-
running.set(true);
107+
this.running.set(true);
107108
try {
108109
load(engine, binding, executedClasses, true);
109110
} finally {
110-
running.set(false);
111+
this.running.set(false);
111112
postRun();
112113
setCurrentScript(null);
113114
}

0 commit comments

Comments
 (0)