Skip to content

Commit

Permalink
fix: halo renderer bug messing up rendering of various mods
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTJP committed Nov 30, 2023
1 parent 196fa19 commit 43b5a8a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions core/src/main/java/mrtjp/projectred/core/client/HaloRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ public static void onRenderWorldLastEvent(final RenderLevelLastEvent event) {
// Unfabulous rendering. Batched rendering doesn't seem to work from stage events when not
// on fabulous for some reason, so we have to do it here instead.
if (!isFabulous()) {
if (levelLights.isEmpty()) return;

// Poll all pending lights from queue
List<LevelLight> lightList = new LinkedList<>();
LevelLight l;
while ((l = levelLights.poll()) != null) {
lightList.add(l);
}

// Prepare render
Vec3 cam = Minecraft.getInstance().getEntityRenderDispatcher().camera.getPosition();
PoseStack stack = event.getPoseStack();
stack.pushPose();
Expand All @@ -185,22 +195,17 @@ public static void onRenderWorldLastEvent(final RenderLevelLastEvent event) {
ccrs.reset();
MultiBufferSource.BufferSource buffers = Minecraft.getInstance().renderBuffers().bufferSource();

// Build light list
List<LevelLight> lightList = new LinkedList<>();
LevelLight l;
while ((l = levelLights.poll()) != null) {
lightList.add(l);
}

// Render to normal render target for primary visuals
ccrs.bind(HALO_GLOW_RENDER_TYPE, buffers, stack);
for (LevelLight light : lightList) {
renderToCCRS(ccrs, light.box, light.colour, light.t, HaloContext.LEVEL_RENDERER);
}

// Finish render
buffers.endBatch();
stack.popPose();
}


// Fabulous bloom post-processing effects rendered here instead of during stage
if (isFabulous() && postChainFlushPending) {
postChainFlushPending = false;
Expand Down

0 comments on commit 43b5a8a

Please sign in to comment.