Skip to content

Commit

Permalink
Disable global indigo renderer by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Su5eD committed Jul 7, 2023
1 parent 156c720 commit b4bfac2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private static TriState asTriState(String property) {
final boolean forceCompatibility = IndigoMixinConfigPlugin.shouldForceCompatibility();
ENSURE_VERTEX_FORMAT_COMPATIBILITY = forceCompatibility;
// necessary because OF alters the BakedModel vertex format and will confuse the fallback model consumer
ALWAYS_TESSELATE_INDIGO = !forceCompatibility && asBoolean((String) properties.computeIfAbsent("always-tesselate-blocks", (a) -> "auto"), true);
ALWAYS_TESSELATE_INDIGO = !forceCompatibility && asBoolean((String) properties.computeIfAbsent("always-tesselate-blocks", (a) -> "auto"), false);
AMBIENT_OCCLUSION_MODE = asEnum((String) properties.computeIfAbsent("ambient-occlusion-mode", (a) -> "hybrid"), AoConfig.HYBRID);
DEBUG_COMPARE_LIGHTING = asBoolean((String) properties.computeIfAbsent("debug-compare-lighting", (a) -> "auto"), false);
FIX_SMOOTH_LIGHTING_OFFSET = asBoolean((String) properties.computeIfAbsent("fix-smooth-lighting-offset", (a) -> "auto"), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

package net.fabricmc.fabric.mixin.client.indigo.renderer;

import net.minecraft.client.render.RenderLayer;

import net.minecraftforge.client.model.data.ModelData;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -39,8 +42,8 @@ public abstract class BlockModelRendererMixin {
@Unique
private final ThreadLocal<BlockRenderContext> fabric_contexts = ThreadLocal.withInitial(BlockRenderContext::new);

@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", cancellable = true)
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean cull, Random rand, long seed, int overlay, CallbackInfo ci) {
@Inject(at = @At("HEAD"), method = "tesselateBlock(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JILnet/minecraftforge/client/model/data/ModelData;Lnet/minecraft/client/render/RenderLayer;Z)V", cancellable = true)
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean cull, Random rand, long seed, int overlay, ModelData modelData, RenderLayer renderType, boolean queryModelSpecificData, CallbackInfo ci) {
if (!model.isVanillaAdapter()) {
BlockRenderContext context = fabric_contexts.get();
context.render(blockView, model, state, pos, matrix, buffer, cull, rand, seed, overlay);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void hookChunkBuildTesselate(BlockRenderManager renderManager, BlockStat
}
}

renderManager.renderBlock(blockState, blockPos, blockView, matrix, bufferBuilder, checkSides, random);
renderManager.renderBatched(blockState, blockPos, blockView, matrix, bufferBuilder, checkSides, random, modelData, renderLayer, queryModelSpecificData);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ public void setBlockTransparency(Block block, boolean transparent) {

@Override
public boolean isBlockTransparent(Block block) {
return overlayBlocks.computeIfAbsent(block, k -> k instanceof TransparentBlock || k instanceof LeavesBlock);
if (overlayBlocks.containsKey(block)) {
return overlayBlocks.get(block);
}
return block instanceof TransparentBlock || block instanceof LeavesBlock;
}

@Override
public boolean isBlockTransparent(BlockState state, BlockRenderView level, BlockPos pos, FluidState fluidState) {
return overlayBlocks.computeIfAbsent(state.getBlock(), block -> block.shouldDisplayFluidOverlay(state, level, pos, fluidState));
}

public void onFluidRendererReload(FluidRenderer renderer, Sprite[] waterSprites, Sprite[] lavaSprites, Sprite waterOverlay) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ loom.platform=forge
forge_version=1.19.4-45.1.2
server_data_pack_format=12
pack_format=13
forgified_version=1.1.0
forgified_version=1.2.0

0 comments on commit b4bfac2

Please sign in to comment.