dev.creoii.creoapi.impl.shader.ShaderInteractionImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of creo-shader-interaction-api Show documentation
Show all versions of creo-shader-interaction-api Show documentation
Interaction with vanilla shaders.
The newest version!
package dev.creoii.creoapi.impl.shader;
import dev.creoii.creoapi.impl.shader.util.PostProcessorInteraction;
import net.minecraft.class_2960;
import net.minecraft.class_310;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;
@ApiStatus.Internal
public final class ShaderInteractionImpl {
private static final class_310 CLIENT = class_310.method_1551();
@Nullable
public static class_2960 getCurrentPostProcessorInternal() {
if (checkSafe())
return ((PostProcessorInteraction) CLIENT.field_1773).creo$getCurrentPostProcessor();
return null;
}
public static void setCurrentPostProcessorInternal(class_2960 id) {
if (checkSafe())
((PostProcessorInteraction) CLIENT.field_1773).creo$setCurrentPostProcessor(fixId(id));
}
public static void clearPostProcessorsInternal() {
if (checkSafe())
((PostProcessorInteraction) CLIENT.field_1773).creo$clearPostProcessors();
}
private static boolean checkSafe() {
return CLIENT != null && CLIENT.field_1773 != null;
}
private static class_2960 fixId(class_2960 id) {
return id.method_45138("shaders/").method_48331(".json");
}
}