2323
2424package com .falsepattern .falsetweaks .modules .threadedupdates ;
2525
26+ import com .falsepattern .falsetweaks .Compat ;
2627import com .falsepattern .falsetweaks .Share ;
2728import com .falsepattern .falsetweaks .Tags ;
2829import com .falsepattern .falsetweaks .config .ModuleConfig ;
4546import it .unimi .dsi .fastutil .ints .IntSet ;
4647import lombok .RequiredArgsConstructor ;
4748import lombok .val ;
49+ import mega .fluidlogged .api .FLBlockAccess ;
4850
4951import net .minecraft .block .Block ;
5052import net .minecraft .block .material .Material ;
@@ -219,6 +221,33 @@ private static int doChunkUpdateForRenderPass(WorldRenderer wr, UpdateTask task,
219221
220222 private static final IntSet alreadyWarnedRenderTypes = new IntArraySet ();
221223
224+ private static class FluidLoggedCompat {
225+ public static int drawFluidLogged (WorldRenderer wr , UpdateTask task , ChunkCache chunkcache , Tessellator tess , int pass , int flags , RenderBlocks renderblocks , int x , int y , int z ) {
226+ val fluid = ((FLBlockAccess )chunkcache ).fl$getFluid (x , y , z );
227+ if (fluid == null ) {
228+ return flags ;
229+ }
230+ val fluidBlock = fluid .getBlock ();
231+ if (fluidBlock == null ) {
232+ return flags ;
233+ }
234+
235+ if (fluidBlock .getRenderBlockPass () > pass ) {
236+ flags |= BIT_NextPass ;
237+ }
238+ if (!fluidBlock .canRenderInPass (pass )) {
239+ return flags ;
240+ }
241+
242+ flags = startTessellator (wr , task , tess , pass , flags );
243+
244+ try {
245+ flags |= renderblocks .renderBlockByRenderType (fluidBlock , x , y , z ) ? BIT_RenderedSomething : 0 ;
246+ } catch (Exception ignored ) {}
247+ return flags ;
248+ }
249+ }
250+
222251 private static int doChunkUpdateForRenderPassBlock (WorldRenderer wr , UpdateTask task , ChunkCache chunkcache , Tessellator tess , int pass , RenderBlocks renderblocks , int x , int y , int z , int flags ) {
223252 Block block = chunkcache .getBlock (x , y , z );
224253 val rt = block .getRenderType ();
@@ -238,24 +267,19 @@ private static int doChunkUpdateForRenderPassBlock(WorldRenderer wr, UpdateTask
238267 }
239268 }
240269
270+ if (Compat .fluidloggedInstalled ()) {
271+ flags = FluidLoggedCompat .drawFluidLogged (wr , task , chunkcache , tess , pass , flags , renderblocks , x , y , z );
272+ }
273+
241274 if (block .getRenderBlockPass () > pass ) {
242275 flags |= BIT_NextPass ;
243276 }
244277
245278 if (!block .canRenderInPass (pass )) {
246279 return flags ;
247280 }
248- if (!hasFlag (flags , BIT_StartedTessellator )) {
249- if (ModuleConfig .TRIANGULATOR ()) {
250- ToggleableTessellatorManager .preRenderBlocks (pass );
251- }
252- flags |= BIT_StartedTessellator ;
253- if (AGGRESSIVE_NEODYMIUM_THREADING ) {
254- NeodymiumCompat .beginRenderPass (task , wr , pass );
255- }
256- tess .startDrawingQuads ();
257- tess .setTranslation (-wr .posX , -wr .posY , -wr .posZ );
258- }
281+
282+ flags = startTessellator (wr , task , tess , pass , flags );
259283
260284 try {
261285 flags |= renderblocks .renderBlockByRenderType (block , x , y , z ) ? BIT_RenderedSomething : 0 ;
@@ -278,6 +302,21 @@ private static int doChunkUpdateForRenderPassBlock(WorldRenderer wr, UpdateTask
278302 return flags ;
279303 }
280304
305+ private static int startTessellator (WorldRenderer wr , UpdateTask task , Tessellator tess , int pass , int flags ) {
306+ if (!hasFlag (flags , BIT_StartedTessellator )) {
307+ if (ModuleConfig .TRIANGULATOR ()) {
308+ ToggleableTessellatorManager .preRenderBlocks (pass );
309+ }
310+ flags |= BIT_StartedTessellator ;
311+ if (AGGRESSIVE_NEODYMIUM_THREADING ) {
312+ NeodymiumCompat .beginRenderPass (task , wr , pass );
313+ }
314+ tess .startDrawingQuads ();
315+ tess .setTranslation (-wr .posX , -wr .posY , -wr .posZ );
316+ }
317+ return flags ;
318+ }
319+
281320 public static boolean isMainThread () {
282321 val thread = Thread .currentThread ();
283322 if (MAIN_THREAD == null )
0 commit comments