mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-28 16:06:28 +01:00
Final loader and temporary ShaderSources
This commit is contained in:
parent
947c611bbc
commit
4817ce3fe1
2 changed files with 11 additions and 14 deletions
|
@ -35,9 +35,7 @@ public class Backend {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Minecraft minecraft;
|
public final Loader loader;
|
||||||
public ShaderSources sources;
|
|
||||||
public Loader loader;
|
|
||||||
|
|
||||||
public GLCapabilities capabilities;
|
public GLCapabilities capabilities;
|
||||||
public GlCompat compat;
|
public GlCompat compat;
|
||||||
|
@ -52,10 +50,6 @@ public class Backend {
|
||||||
private final Map<ResourceLocation, ProgramSpec> programSpecRegistry = new HashMap<>();
|
private final Map<ResourceLocation, ProgramSpec> programSpecRegistry = new HashMap<>();
|
||||||
|
|
||||||
protected Backend() {
|
protected Backend() {
|
||||||
// Can be null when running datagenerators due to the unfortunate time we call this
|
|
||||||
minecraft = Minecraft.getInstance();
|
|
||||||
if (minecraft == null) return;
|
|
||||||
|
|
||||||
loader = new Loader(this);
|
loader = new Loader(this);
|
||||||
|
|
||||||
OptifineHandler.init();
|
OptifineHandler.init();
|
||||||
|
|
|
@ -42,15 +42,18 @@ public class Loader implements ISelectiveResourceReloadListener {
|
||||||
private static final Gson GSON = new GsonBuilder().create();
|
private static final Gson GSON = new GsonBuilder().create();
|
||||||
|
|
||||||
private final Backend backend;
|
private final Backend backend;
|
||||||
public boolean shouldCrash;
|
private boolean shouldCrash;
|
||||||
|
|
||||||
|
|
||||||
public Loader(Backend backend) {
|
public Loader(Backend backend) {
|
||||||
this.backend = backend;
|
this.backend = backend;
|
||||||
|
|
||||||
IResourceManager manager = backend.minecraft.getResourceManager();
|
// Can be null when running datagenerators due to the unfortunate time we call this
|
||||||
if (manager instanceof IReloadableResourceManager) {
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
((IReloadableResourceManager) manager).registerReloadListener(this);
|
if (minecraft != null) {
|
||||||
|
IResourceManager manager = minecraft.getResourceManager();
|
||||||
|
if (manager instanceof IReloadableResourceManager) {
|
||||||
|
((IReloadableResourceManager) manager).registerReloadListener(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +74,11 @@ public class Loader implements ISelectiveResourceReloadListener {
|
||||||
ModLoader.get()
|
ModLoader.get()
|
||||||
.postEvent(new GatherContextEvent(backend));
|
.postEvent(new GatherContextEvent(backend));
|
||||||
|
|
||||||
backend.sources = new ShaderSources(manager);
|
ShaderSources sources = new ShaderSources(manager);
|
||||||
|
|
||||||
loadProgramSpecs(manager);
|
loadProgramSpecs(manager);
|
||||||
|
|
||||||
Resolver.INSTANCE.resolve(backend.sources);
|
Resolver.INSTANCE.resolve(sources);
|
||||||
|
|
||||||
for (IShaderContext<?> context : backend.allContexts()) {
|
for (IShaderContext<?> context : backend.allContexts()) {
|
||||||
context.load();
|
context.load();
|
||||||
|
|
Loading…
Reference in a new issue