All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.creoii.creoapi.impl.shader.ShaderInteractionImpl Maven / Gradle / Ivy

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");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy