Skip to content

Commit 32111d9

Browse files
committed
fixed accidental reintroduced bug
1 parent 5f14b55 commit 32111d9

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/main/java/com/moreoutlines/mixins/WorldRendererMixin.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import net.minecraft.client.render.BufferBuilderStorage;
1313
import net.minecraft.client.render.WorldRenderer;
1414
import net.minecraft.client.world.ClientWorld;
15+
import net.minecraft.registry.Registries;
16+
import net.minecraft.util.Identifier;
1517
import org.spongepowered.asm.mixin.Mixin;
1618
import org.spongepowered.asm.mixin.injection.At;
1719
import org.spongepowered.asm.mixin.injection.Inject;
@@ -39,19 +41,25 @@ private void redirectBlockEntityRender(BlockEntityRenderDispatcher dispatcher, B
3941
// Always render normally first
4042
dispatcher.render(blockEntity, tickProgress, matrices, vertexConsumers);
4143

42-
// Only render outlines if enabled
43-
if (ModConfig.INSTANCE.outlinesEnabled) {
44-
OutlineVertexConsumerProvider outlineProvider = this.bufferBuilders.getOutlineVertexConsumers();
44+
// Only render outlines if enabled AND the specific block entity type is selected
45+
if (ModConfig.INSTANCE.outlinesEnabled && blockEntity != null) {
46+
// Get the block entity's block type
47+
Identifier blockId = Registries.BLOCK.getId(blockEntity.getCachedState().getBlock());
4548

46-
// Extract color components from config
47-
int color = ModConfig.INSTANCE.defaultColor;
48-
int red = (color >> 16) & 0xFF;
49-
int green = (color >> 8) & 0xFF;
50-
int blue = color & 0xFF;
51-
int alpha = (color >> 24) & 0xFF;
52-
53-
outlineProvider.setColor(red, green, blue, alpha);
54-
dispatcher.render(blockEntity, tickProgress, matrices, outlineProvider);
49+
// Only render outline if this specific block type is selected
50+
if (ModConfig.INSTANCE.isBlockSelected(blockId)) {
51+
OutlineVertexConsumerProvider outlineProvider = this.bufferBuilders.getOutlineVertexConsumers();
52+
53+
// Get the color for this specific block type
54+
int color = ModConfig.INSTANCE.getBlockColor(blockId);
55+
int red = (color >> 16) & 0xFF;
56+
int green = (color >> 8) & 0xFF;
57+
int blue = color & 0xFF;
58+
int alpha = (color >> 24) & 0xFF;
59+
60+
outlineProvider.setColor(red, green, blue, alpha);
61+
dispatcher.render(blockEntity, tickProgress, matrices, outlineProvider);
62+
}
5563
}
5664
}
5765

0 commit comments

Comments
 (0)