Skip to content

Commit d0128df

Browse files
committed
Explicitly add minecraft jar path to the resource packs
1 parent 706101d commit d0128df

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/test/java/dev/thatredox/chunkynative/opencl/CornellBoxRenderTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.junit.jupiter.api.BeforeAll;
44
import org.junit.jupiter.api.Test;
5+
import se.llbit.chunky.PersistentSettings;
56
import se.llbit.chunky.main.Chunky;
67
import se.llbit.chunky.main.ChunkyOptions;
78
import se.llbit.chunky.main.CommandLineOptions;
@@ -24,11 +25,17 @@ static void download_mc() {
2425
new CommandLineOptions(new String[] { "-download-mc", "1.21.8" });
2526
}
2627

28+
private static String getMcPath() {
29+
return new File(new File(PersistentSettings.settingsDirectory(), "resources"), "minecraft.jar").getPath();
30+
}
31+
2732
@Test
2833
void render() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException {
2934
// Initialize Chunky
3035
Chunky.loadDefaultTextures();
31-
Chunky chunky = new Chunky(ChunkyOptions.getDefaults());
36+
ChunkyOptions options = ChunkyOptions.getDefaults();
37+
options.addResourcePacks(getMcPath());
38+
Chunky chunky = new Chunky(options);
3239
Field chunkyHeadless = chunky.getClass().getDeclaredField("headless");
3340
chunkyHeadless.setAccessible(true);
3441
chunkyHeadless.set(chunky, true);
@@ -57,7 +64,9 @@ void render() throws IOException, InterruptedException, NoSuchFieldException, Il
5764
void preview_render() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException {
5865
// Initialize Chunky
5966
Chunky.loadDefaultTextures();
60-
Chunky chunky = new Chunky(ChunkyOptions.getDefaults());
67+
ChunkyOptions options = ChunkyOptions.getDefaults();
68+
options.addResourcePacks(getMcPath());
69+
Chunky chunky = new Chunky(options);
6170
Field chunkyHeadless = chunky.getClass().getDeclaredField("headless");
6271
chunkyHeadless.setAccessible(true);
6372
chunkyHeadless.set(chunky, true);

0 commit comments

Comments
 (0)