Skip to content

Commit

Permalink
change: Fix beacon beam color
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Jun 14, 2024
1 parent fb9720b commit 50ebe8b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ public static CaffeineConfig mixinConfig() {
.addMixinOption("gui", true)
.addMixinOption("instant_sneak", true)
.addMixinOption("light_updates", true)
.addMixinOption("optimizations", false)
.addMixinOption("optimizations.beacon_beam_rendering", false)
.addMixinOption("optimizations", true)
.addMixinOption("optimizations.beacon_beam_rendering", true)
.addMixinOption("optimizations.draw_helpers", false)
.addMixinOption("optimizations.fast_weather", false)
.addMixinOption("particle", true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package me.flashyreese.mods.sodiumextra.mixin.optimizations.beacon_beam_rendering;

import me.flashyreese.mods.sodiumextra.common.util.ColorRGBA;
import me.flashyreese.mods.sodiumextra.compat.IrisCompat;
import net.caffeinemc.mods.sodium.api.math.MatrixHelper;
import net.caffeinemc.mods.sodium.api.util.ColorARGB;
import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter;
import net.caffeinemc.mods.sodium.api.vertex.format.common.ModelVertex;
import net.minecraft.block.entity.BeaconBlockEntity;
Expand Down Expand Up @@ -57,7 +59,8 @@ private static void optimizeRenderBeam(MatrixStack matrices, VertexConsumerProvi
try (MemoryStack stack = MemoryStack.stackPush()) {
long buffer = stack.nmalloc(2 * 16 * ModelVertex.STRIDE);
long ptr = buffer;
ptr = writeBeamLayerVertices(ptr, matrices, color, yOffset, height, 0.0F, innerRadius, innerRadius, 0.0F, innerX3, 0.0F, 0.0F, innerZ4, innerV1, innerV2);
// Note: ModelVertex color takes in ABGR
ptr = writeBeamLayerVertices(ptr, matrices, ColorARGB.toABGR(color), yOffset, height, 0.0F, innerRadius, innerRadius, 0.0F, innerX3, 0.0F, 0.0F, innerZ4, innerV1, innerV2);
VertexBufferWriter.of(vertexConsumerProvider.getBuffer(RenderLayer.getBeaconBeam(textureId, false))).push(stack, buffer, 16, ModelVertex.FORMAT);

matrices.pop();
Expand All @@ -69,7 +72,7 @@ private static void optimizeRenderBeam(MatrixStack matrices, VertexConsumerProvi
innerV1 = (float) maxY * heightScale + innerV2;

buffer = ptr;
ptr = writeBeamLayerVertices(ptr, matrices, ColorHelper.Argb.withAlpha(32, color), yOffset, height, innerX1, outerZ1, outerRadius, innerZ2, innerX3, outerRadius, outerRadius, outerRadius, innerV1, innerV2);
ptr = writeBeamLayerVertices(ptr, matrices, ColorARGB.toABGR(color, 32), yOffset, height, innerX1, outerZ1, outerRadius, innerZ2, innerX3, outerRadius, outerRadius, outerRadius, innerV1, innerV2);
VertexBufferWriter.of(vertexConsumerProvider.getBuffer(RenderLayer.getBeaconBeam(textureId, true))).push(stack, buffer, 16, ModelVertex.FORMAT);
}
matrices.pop();
Expand Down

0 comments on commit 50ebe8b

Please sign in to comment.