Skip to content

Commit

Permalink
Automatically enable render list logic if vanilla meshes are enabled
Browse files Browse the repository at this point in the history
Since otherwise no meshes get built.
This also simplifies the workaround for Factorization, see #49
  • Loading branch information
makamys committed Mar 19, 2024
1 parent bbe5d3a commit 4a3cc3d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
8 changes: 8 additions & 0 deletions src/main/java/makamys/neodymium/Compat.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ public static void init() {

IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED = checkIfHodgepodgeSpeedupAnimationsIsEnabled();
}

public static boolean enableVanillaChunkMeshes() {
return Config.enableVanillaChunkMeshes && !isFalseTweaksModPresent();
}

public static boolean keepRenderListLogic() {
return enableVanillaChunkMeshes() || Constants.KEEP_RENDER_LIST_LOGIC;
}

private static boolean checkIfHodgepodgeSpeedupAnimationsIsEnabled() {
boolean result = false;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/makamys/neodymium/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class Config {
public static boolean showDebugInfo;
@ConfigBoolean(cat="debug", def=false)
public static boolean wireframe;
@ConfigBoolean(cat="debug", def=false, com="Enable building of vanilla chunk meshes. Makes it possible to switch to the vanilla renderer on the fly, at the cost of reducing chunk update performance.")
@ConfigBoolean(cat="debug", def=false, com="Enable building of vanilla chunk meshes. Makes it possible to switch to the vanilla renderer on the fly, at the cost of reducing chunk update performance. Also fixes compatibility with Factorization (see issue #49).\nCompatibility note: Not compatible with FalseTweaks, so enabling this will have no effect if FalseTweaks is present.")
public static boolean enableVanillaChunkMeshes;

private static Configuration config;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import makamys.neodymium.Constants;
import makamys.neodymium.Compat;
import makamys.neodymium.Neodymium;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.WorldRenderer;
Expand Down Expand Up @@ -41,7 +41,7 @@ private void blockVanillaChunkRendering(int p1, double p2, CallbackInfo ci) {
public void preRenderSortedRenderers(int startRenderer, int numRenderers, int renderPass, double partialTickTime, CallbackInfoReturnable<Integer> cir) {
if(Neodymium.isActive()) {
int updated = Neodymium.renderer.preRenderSortedRenderers(renderPass, partialTickTime, sortedWorldRenderers);
if(!Constants.KEEP_RENDER_LIST_LOGIC) {
if(!Compat.keepRenderListLogic()) {
cir.setReturnValue(updated);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.google.common.collect.Lists;
import makamys.neodymium.Compat;
import makamys.neodymium.Constants;
import makamys.neodymium.Neodymium;
import makamys.neodymium.ducks.ITessellator;
import makamys.neodymium.ducks.IWorldRenderer;
Expand Down Expand Up @@ -113,7 +112,7 @@ private void prePreRenderBlocks(int pass, CallbackInfo ci) {
target = "Lorg/lwjgl/opengl/GL11;glNewList(II)V"),
require = 1)
private void noNewList(int list, int mode) {
if (!Neodymium.isActive() || Constants.KEEP_RENDER_LIST_LOGIC) {
if (!Neodymium.isActive() || Compat.keepRenderListLogic()) {
GL11.glNewList(list, mode);
}
}
Expand All @@ -123,7 +122,7 @@ private void noNewList(int list, int mode) {
target = "Lorg/lwjgl/opengl/GL11;glEndList()V"),
require = 1)
private void noEndList() {
if (!Neodymium.isActive() || Constants.KEEP_RENDER_LIST_LOGIC)
if (!Neodymium.isActive() || Compat.keepRenderListLogic())
GL11.glEndList();
}

Expand Down
5 changes: 2 additions & 3 deletions src/main/java/makamys/neodymium/renderer/NeoRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.falsepattern.rple.api.client.RPLEShaderConstants;
import lombok.val;
import makamys.neodymium.Compat;
import makamys.neodymium.Constants;
import makamys.neodymium.Neodymium;
import makamys.neodymium.config.Config;
import makamys.neodymium.ducks.IWorldRenderer;
Expand Down Expand Up @@ -148,7 +147,7 @@ public int preRenderSortedRenderers(int renderPass, double alpha, WorldRenderer[

initIndexBuffers();

if(!Constants.KEEP_RENDER_LIST_LOGIC && !Compat.isFalseTweaksModPresent()) {
if(!Compat.keepRenderListLogic() && !Compat.isFalseTweaksModPresent()) {
updateRenderGlobalStats();
}
}
Expand Down Expand Up @@ -211,7 +210,7 @@ private void initIndexBuffers() {
for (int j = piCount[i].position() - meshes; j < piCount[i].position(); j++) {
renderedQuads += piCount[i].get(j) / 4;
}
if(Compat.isHodgepodgeSpeedupAnimationsEnabled() && !Constants.KEEP_RENDER_LIST_LOGIC) {
if(Compat.isHodgepodgeSpeedupAnimationsEnabled() && !Compat.keepRenderListLogic()) {
// Hodgepodge hooks this method to decide what animations to play, make sure it runs
wr.getGLCallListForPass(i);
}
Expand Down

0 comments on commit 4a3cc3d

Please sign in to comment.