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

dev.creoii.creoapi.mixin.block.compat.ChunkBuilderMeshingTaskMixin Maven / Gradle / Ivy

package dev.creoii.creoapi.mixin.block.compat;

import com.llamalad7.mixinextras.sugar.Local;
import dev.creoii.creoapi.api.block.CreoBlock;
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers;
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildContext;
import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildOutput;
import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderCache;
import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.BlockRenderContext;
import me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask;
import me.jellysquid.mods.sodium.client.util.task.CancellationToken;
import net.minecraft.class_2338;
import net.minecraft.class_2680;
import net.minecraft.class_5819;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ChunkBuilderMeshingTask.class)
public class ChunkBuilderMeshingTaskMixin {
    @Inject(method = "execute(Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildContext;Lme/jellysquid/mods/sodium/client/util/task/CancellationToken;)Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildOutput;", at = @At(value = "INVOKE", target = "Lme/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderer;renderModel(Lme/jellysquid/mods/sodium/client/render/chunk/compile/pipeline/BlockRenderContext;Lme/jellysquid/mods/sodium/client/render/chunk/compile/ChunkBuildBuffers;)V", shift = At.Shift.AFTER), remap = false)
    private void gbw$renderSnowOverlay(ChunkBuildContext buildContext, CancellationToken cancellationToken, CallbackInfoReturnable cir, @Local ChunkBuildBuffers buffers, @Local BlockRenderCache cache, @Local(ordinal = 0) class_2338.class_2339 blockPos, @Local(ordinal = 1) class_2338.class_2339 modelOffset, @Local BlockRenderContext context, @Local class_2680 blockState, @Local long seed) {
        if (blockState.method_26204() instanceof CreoBlock creoBlock) {
            class_2680 state = creoBlock.getOverlayState(blockState, blockPos, class_5819.method_43049(seed));
            context.update(blockPos, modelOffset, state, cache.getBlockModels().method_3335(state), seed);
            cache.getBlockRenderer().renderModel(context, buffers);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy