|
12 | 12 | import net.minecraft.client.render.BufferBuilderStorage; |
13 | 13 | import net.minecraft.client.render.WorldRenderer; |
14 | 14 | import net.minecraft.client.world.ClientWorld; |
| 15 | +import net.minecraft.registry.Registries; |
| 16 | +import net.minecraft.util.Identifier; |
15 | 17 | import org.spongepowered.asm.mixin.Mixin; |
16 | 18 | import org.spongepowered.asm.mixin.injection.At; |
17 | 19 | import org.spongepowered.asm.mixin.injection.Inject; |
@@ -39,19 +41,25 @@ private void redirectBlockEntityRender(BlockEntityRenderDispatcher dispatcher, B |
39 | 41 | // Always render normally first |
40 | 42 | dispatcher.render(blockEntity, tickProgress, matrices, vertexConsumers); |
41 | 43 |
|
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()); |
45 | 48 |
|
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 | + } |
55 | 63 | } |
56 | 64 | } |
57 | 65 |
|
|
0 commit comments