From 616b5e463c4a86f8c7c2398ffcab829567656a50 Mon Sep 17 00:00:00 2001 From: AterAnimAvis Date: Sat, 1 May 2021 12:19:38 +0100 Subject: [PATCH] fix: dumb mistake with PriorityQueue #27 --- Would you believe this was actually in an old stashed change... whoops Signed-off-by: AterAnimAvis --- .../java/com/unascribed/blockrenderer/render/IRequest.java | 4 ++++ .../fabric/client/render/manager/RenderManager.java | 3 ++- .../forge/client/render/manager/RenderManager.java | 3 ++- gradle.properties | 2 +- .../client/render/manager/RenderManager.java.patch | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/com/unascribed/blockrenderer/render/IRequest.java b/common/src/main/java/com/unascribed/blockrenderer/render/IRequest.java index 8b03ab8..7b99383 100644 --- a/common/src/main/java/com/unascribed/blockrenderer/render/IRequest.java +++ b/common/src/main/java/com/unascribed/blockrenderer/render/IRequest.java @@ -4,4 +4,8 @@ public interface IRequest { boolean render(); + default int priority() { + return 0; + } + } diff --git a/fabric/src/main/java/com/unascribed/blockrenderer/fabric/client/render/manager/RenderManager.java b/fabric/src/main/java/com/unascribed/blockrenderer/fabric/client/render/manager/RenderManager.java index a467337..a76555c 100644 --- a/fabric/src/main/java/com/unascribed/blockrenderer/fabric/client/render/manager/RenderManager.java +++ b/fabric/src/main/java/com/unascribed/blockrenderer/fabric/client/render/manager/RenderManager.java @@ -7,6 +7,7 @@ import net.minecraft.util.text.TextFormatting; import org.jetbrains.annotations.Nullable; +import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; import java.util.function.Function; @@ -23,7 +24,7 @@ public class RenderManager extends BaseRenderManager { public static final BaseRenderManager INSTANCE = new RenderManager(); public static boolean isRendering = false; - public static Queue requests = new PriorityQueue<>(); + public static Queue requests = new PriorityQueue<>(Comparator.comparingInt(IRequest::priority)); @Nullable private static IRequest request = null; diff --git a/forge/src/main/java/com/unascribed/blockrenderer/forge/client/render/manager/RenderManager.java b/forge/src/main/java/com/unascribed/blockrenderer/forge/client/render/manager/RenderManager.java index 0956af6..647c4a3 100644 --- a/forge/src/main/java/com/unascribed/blockrenderer/forge/client/render/manager/RenderManager.java +++ b/forge/src/main/java/com/unascribed/blockrenderer/forge/client/render/manager/RenderManager.java @@ -7,6 +7,7 @@ import net.minecraft.util.text.TextFormatting; import org.jetbrains.annotations.Nullable; +import java.util.Comparator; import java.util.PriorityQueue; import java.util.Queue; import java.util.function.Function; @@ -23,7 +24,7 @@ public class RenderManager extends BaseRenderManager { public static final BaseRenderManager INSTANCE = new RenderManager(); public static boolean isRendering = false; - public static Queue requests = new PriorityQueue<>(); + public static Queue requests = new PriorityQueue<>(Comparator.comparingInt(IRequest::priority)); @Nullable private static IRequest request = null; diff --git a/gradle.properties b/gradle.properties index 8ec309b..fcaaef7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ yarnBuild =9.mcp.snapshot.20201028.1.16.3 ##################################### Mod ##################################### modId =block_renderer -modVersion =1.5.2 +modVersion =1.5.3 modGroup =com.unascribed vendor =AterAnimAvis diff --git a/patches/forge2fabric/client/render/manager/RenderManager.java.patch b/patches/forge2fabric/client/render/manager/RenderManager.java.patch index 98f917b..ee834b7 100644 --- a/patches/forge2fabric/client/render/manager/RenderManager.java.patch +++ b/patches/forge2fabric/client/render/manager/RenderManager.java.patch @@ -9,7 +9,7 @@ import com.unascribed.blockrenderer.render.IRequest; import com.unascribed.blockrenderer.render.manager.BaseRenderManager; import net.minecraft.util.text.ITextComponent; -@@ -11,7 +11,7 @@ +@@ -12,7 +12,7 @@ import java.util.Queue; import java.util.function.Function;