Search in sources :

Example 1 with DynamicBakedModel

use of grondag.frex.api.model.DynamicBakedModel in project canvas by vram-guild.

the class MixinItemRenderer method hookRenderModel.

@Inject(at = @At("HEAD"), method = "renderModel", cancellable = true)
private void hookRenderModel(BakedModel model, int color, ItemStack stack, CallbackInfo ci) {
    final DynamicBakedModel dynamicModel = (DynamicBakedModel) model;
    if (Configurator.itemShaderRender) {
        // PERF: redirect most of the enables so we don't have to change state here each time
        GuiLightingHelper.suspend();
        context.renderModel(dynamicModel, color, stack);
        GuiLightingHelper.resume();
        ci.cancel();
    } else {
        if (!dynamicModel.isVanillaAdapter()) {
            oldContext.renderModel(dynamicModel, color, stack, (b, q, c, s) -> renderQuadsInner(b, q, c, s));
            ci.cancel();
        }
    }
}
Also used : DynamicBakedModel(grondag.frex.api.model.DynamicBakedModel) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with DynamicBakedModel

use of grondag.frex.api.model.DynamicBakedModel in project canvas by vram-guild.

the class TerrainRenderContext method tesselateBlock.

/**
 * Called from chunk renderer hook.
 */
public void tesselateBlock(BlockState blockState, BlockPos blockPos) {
    try {
        final BakedModel model = blockRenderManager.getModel(blockState);
        aoCalc.clear();
        blockInfo.prepareForBlock(blockState, blockPos, model.useAmbientOcclusion());
        chunkInfo.beginBlock();
        ((DynamicBakedModel) model).emitBlockQuads(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, blockInfo.randomSupplier, this);
    } catch (final Throwable var9) {
        final CrashReport crashReport_1 = CrashReport.create(var9, "Tesselating block in world - Canvas Renderer");
        final CrashReportSection crashReportElement_1 = crashReport_1.addElement("Block being tesselated");
        CrashReportSection.addBlockInfo(crashReportElement_1, blockPos, blockState);
        throw new CrashException(crashReport_1);
    }
}
Also used : CrashException(net.minecraft.util.crash.CrashException) DynamicBakedModel(grondag.frex.api.model.DynamicBakedModel) CrashReport(net.minecraft.util.crash.CrashReport) BakedModel(net.minecraft.client.render.model.BakedModel) DynamicBakedModel(grondag.frex.api.model.DynamicBakedModel) CrashReportSection(net.minecraft.util.crash.CrashReportSection)

Aggregations

DynamicBakedModel (grondag.frex.api.model.DynamicBakedModel)2 BakedModel (net.minecraft.client.render.model.BakedModel)1 CrashException (net.minecraft.util.crash.CrashException)1 CrashReport (net.minecraft.util.crash.CrashReport)1 CrashReportSection (net.minecraft.util.crash.CrashReportSection)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1