mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-10 06:16:07 +01:00
40 lines
853 B
Java
40 lines
853 B
Java
|
package com.jozufozu.flywheel.glsl;
|
||
|
|
||
|
import java.io.IOException;
|
||
|
import java.util.List;
|
||
|
|
||
|
import org.jetbrains.annotations.NotNull;
|
||
|
import org.jetbrains.annotations.Nullable;
|
||
|
|
||
|
import net.minecraft.resources.ResourceLocation;
|
||
|
|
||
|
public sealed interface LoadResult {
|
||
|
static LoadResult success(SourceFile sourceFile) {
|
||
|
return new Success(sourceFile);
|
||
|
}
|
||
|
|
||
|
@Nullable SourceFile unwrap();
|
||
|
|
||
|
record Success(SourceFile source) implements LoadResult {
|
||
|
@Override
|
||
|
@NotNull
|
||
|
public SourceFile unwrap() {
|
||
|
return source;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
record IOError(ResourceLocation location, IOException exception) implements LoadResult {
|
||
|
@Override
|
||
|
public SourceFile unwrap() {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
record IncludeError(ResourceLocation location, List<LoadResult> innerFailures) implements LoadResult {
|
||
|
@Override
|
||
|
public SourceFile unwrap() {
|
||
|
return null;
|
||
|
}
|
||
|
}
|
||
|
}
|