mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-11 14:56:12 +01:00
4677893690
- Was only ever used for fog - Was the same for every material - Made things unnecessarily complex - Fix fog - Convert ProgramState to record
35 lines
980 B
Java
35 lines
980 B
Java
package com.jozufozu.flywheel.backend;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
import com.jozufozu.flywheel.core.shader.gamestate.IGameStateProvider;
|
|
|
|
import net.minecraft.resources.ResourceLocation;
|
|
|
|
public class GameStateRegistry {
|
|
|
|
private static final Map<ResourceLocation, IGameStateProvider> registeredStateProviders = new HashMap<>();
|
|
|
|
static void clear() {
|
|
registeredStateProviders.clear();
|
|
}
|
|
|
|
public static IGameStateProvider getStateProvider(ResourceLocation location) {
|
|
IGameStateProvider out = registeredStateProviders.get(location);
|
|
|
|
if (out == null) {
|
|
throw new IllegalArgumentException("State provider '" + location + "' does not exist.");
|
|
}
|
|
|
|
return out;
|
|
}
|
|
|
|
public static void register(IGameStateProvider context) {
|
|
if (registeredStateProviders.containsKey(context.getID())) {
|
|
throw new IllegalStateException("Duplicate game state provider: " + context.getID());
|
|
}
|
|
|
|
registeredStateProviders.put(context.getID(), context);
|
|
}
|
|
}
|