Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: makamys/Neodymium
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.2.2
Choose a base ref
...
head repository: makamys/Neodymium
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 16 commits
  • 9 files changed
  • 3 contributors

Commits on Jan 31, 2024

  1. [skip ci] Update update json

    makamys committed Jan 31, 2024
    Copy the full SHA
    4e253b3 View commit details

Commits on Feb 2, 2024

  1. Reimplement vanilla world renderer stats in F3 overlay

    Fixes regression in ad42f10, which caused all values to be 0
    makamys committed Feb 2, 2024
    Copy the full SHA
    2c0e73c View commit details

Commits on Feb 3, 2024

  1. OptiFine moment

    makamys committed Feb 3, 2024
    Copy the full SHA
    377e009 View commit details

Commits on Feb 27, 2024

  1. fix crash with FalseTweaks

    FalsePattern committed Feb 27, 2024
    Copy the full SHA
    153e15e View commit details

Commits on Feb 28, 2024

  1. Merge pull request #50 from FalsePattern/ft-compat

    Fix crash with FalseTweaks
    makamys authored Feb 28, 2024
    Copy the full SHA
    dcfc273 View commit details
  2. Update CI action versions, add missing names

    Integrates changes from #48
    
    Co-Authored-By: Coccocoahelper <157546848+Coccocoahelper@users.noreply.github.com>
    makamys and Coccocoahelper committed Feb 28, 2024
    Copy the full SHA
    68f0baf View commit details
  3. Remove chmod action

    The permissions are supposed to be set on the git repo level. I... think.
    makamys committed Feb 28, 2024
    Copy the full SHA
    d60c4aa View commit details
  4. [skip ci] Update update json

    makamys committed Feb 28, 2024
    Copy the full SHA
    66ac531 View commit details

Commits on Mar 17, 2024

  1. Copy the full SHA
    d1b9f63 View commit details

Commits on Mar 19, 2024

  1. Move WorldRenderer#updateRenderer hooks inside if(needsUpdate) block

    Fixes Phosphor incompat (#19)
    makamys committed Mar 19, 2024
    Copy the full SHA
    bbe5d3a View commit details
  2. Automatically enable render list logic if vanilla meshes are enabled

    Since otherwise no meshes get built.
    This also simplifies the workaround for Factorization, see #49
    makamys committed Mar 19, 2024
    Copy the full SHA
    4a3cc3d View commit details
  3. [skip ci] Update update json

    makamys committed Mar 19, 2024
    Copy the full SHA
    831ea53 View commit details

Commits on Mar 27, 2024

  1. Copy the full SHA
    bc55abe View commit details
  2. Copy the full SHA
    d6c9e97 View commit details
  3. Fix NPEs, improve logging

    makamys committed Mar 27, 2024
    Copy the full SHA
    f78d3d5 View commit details
  4. [skip ci] Update update json

    makamys committed Mar 27, 2024
    Copy the full SHA
    4c2e018 View commit details
12 changes: 7 additions & 5 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -11,22 +11,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout repo
uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2.1.1
- name: Set up JDK 1.8
uses: actions/setup-java@v3
uses: actions/setup-java@v4.0.0
with:
distribution: 'temurin'
java-version: 8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Set up Gradle build
run: ./gradlew SetupCIWorkspace build
- name: Build with Gradle
run: ./gradlew cleanBuildAll
working-directory: publish
- uses: actions/upload-artifact@v3
- name: Upload a build artifact
uses: actions/upload-artifact@v4.3.1
with:
name: Package
path: build/libs
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -53,11 +53,13 @@ There are also some additional optimizations:
The mod increases memory usage, since the chunk meshes have to be stored somewhere. On Normal render distance in a vanilla world, it uses ~70-150 MB, both in RAM and VRAM.

## Incompatibilities
* The mod performs poorly if Advanced OpenGL (occlusion culling) is turned on.
* OptiFine's "Smooth" and "Multi-Core" chunk loading settings are not compatible.
* OptiFine shaders **are** now compatible, but may have some minor issues. FalseTweaks allegedly fixes this.
* CoFHTweaks is incompatible (https://github.com/makamys/Neodymium/issues/11)
* Various coremods may be incompatible with Mixin. Use [Mixingasm](https://github.com/makamys/Mixingasm) to fix this.
* The mod performs poorly if **Advanced OpenGL** (occlusion culling) is turned on.
* **OptiFine**'s "Smooth" and "Multi-Core" chunk loading settings are not compatible.
* **OptiFine** shaders **are** now compatible, but may have some minor issues. FalseTweaks allegedly fixes this.
* **CoFHTweaks** is incompatible (https://github.com/makamys/Neodymium/issues/11)
* **Gilded Game Utils**: the regular version is not compatible - use [the fork with threaded lighting removed](https://legacy.curseforge.com/minecraft/mc-mods/gilded-game-utils-fix) instead.
* **Various coremods** may be incompatible with Mixin. Use [Mixingasm](https://github.com/makamys/Mixingasm) to fix this.
* Also see: [issues labeled with `mod incompatibility`](https://github.com/makamys/Neodymium/issues?q=is%3Aissue+is%3Aopen+label%3A%22mod+incompatibility%22).

### About `nomixin` builds

68 changes: 58 additions & 10 deletions src/main/java/makamys/neodymium/Compat.java
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@ public class Compat {
private static boolean IS_FALSE_TWEAKS_PRESENT;

private static boolean IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED;
private static boolean IS_ANGELICA_SPEEDUP_ANIMATIONS_ENABLED;

private static boolean isShadersEnabled;

@@ -48,25 +49,72 @@ public static void init() {
}

IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED = checkIfHodgepodgeSpeedupAnimationsIsEnabled();
IS_ANGELICA_SPEEDUP_ANIMATIONS_ENABLED = checkIfAngelicaSpeedupAnimationsIsEnabled();
LOGGER.debug("speedupAnimations compat fix will " + (isSpeedupAnimationsEnabled() ? "" : "not ") + "be enabled");
}

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;
Boolean result = null;
if (Loader.isModLoaded("hodgepodge")) {
try {
Class<?> CommonCls = Class.forName("com.mitchej123.hodgepodge.Common");
Object config = CommonCls.getField("config").get(null);
Class<?> configCls = config.getClass();
boolean speedupAnimations = (Boolean)configCls.getField("speedupAnimations").get(config);
LOGGER.debug("Hodgepodge's speedupAnimations is set to " + speedupAnimations);
Class<?> FixesConfigCls = Class.forName("com.mitchej123.hodgepodge.config.FixesConfig");
Boolean speedupAnimations = (Boolean)FixesConfigCls.getField("speedupAnimations").get(null);
result = speedupAnimations;
} catch(Exception e) {
LOGGER.debug("Failed to determine if Hodgepodge's speedupAnimations is enabled using new config class, trying old one.", e);
}
if(result == null) {
try {
Class<?> CommonCls = Class.forName("com.mitchej123.hodgepodge.Common");
Object config = CommonCls.getField("config").get(null);
Class<?> configCls = config.getClass();
boolean speedupAnimations = (Boolean)configCls.getField("speedupAnimations").get(config);
result = speedupAnimations;
} catch(Exception e) {
LOGGER.debug("Failed to determine if Hodgepodge's speedupAnimations is enabled using old config class.", e);
}
}
if(result != null) {
LOGGER.debug("Hodgepodge's speedupAnimations is set to " + result);
} else {
LOGGER.warn("Failed to determine if Hodgepodge's speedupAnimations is enabled, assuming false");
result = false;
}
} else {
LOGGER.debug("Hodgepodge is missing, treating its speedupAnimations as false");
result = false;
}
return result;
}

private static boolean checkIfAngelicaSpeedupAnimationsIsEnabled() {
Boolean result = null;
if (Loader.isModLoaded("angelica")) {
try {
Class<?> AngelicaConfigCls = Class.forName("com.gtnewhorizons.angelica.config.AngelicaConfig");
Boolean speedupAnimations = (Boolean)AngelicaConfigCls.getField("speedupAnimations").get(null);
result = speedupAnimations;
} catch(Exception e) {
LOGGER.debug("Failed to determine if Angelica's speedupAnimations is enabled.", e);
}
if(result != null) {
LOGGER.debug("Angelica's speedupAnimations is set to " + result);
} else {
LOGGER.warn("Failed to determine if Angelica's speedupAnimations is enabled, assuming false");
result = false;
}
} else {
LOGGER.debug("Hodgepodge is missing, treating speedupAnimations as false");
LOGGER.debug("Angelica is missing, treating its speedupAnimations as false");
result = false;
}
LOGGER.debug("Compat fix will " + (result ? "" : "not ") + "be enabled");
return result;
}

@@ -78,8 +126,8 @@ public static boolean isFalseTweaksModPresent() {
return IS_FALSE_TWEAKS_PRESENT;
}

public static boolean isHodgepodgeSpeedupAnimationsEnabled() {
return IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED;
public static boolean isSpeedupAnimationsEnabled() {
return IS_HODGEPODGE_SPEEDUP_ANIMATIONS_ENABLED || IS_ANGELICA_SPEEDUP_ANIMATIONS_ENABLED;
}

public static boolean isOptiFineShadersEnabled() {
2 changes: 1 addition & 1 deletion src/main/java/makamys/neodymium/config/Config.java
Original file line number Diff line number Diff line change
@@ -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;
4 changes: 2 additions & 2 deletions src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java
Original file line number Diff line number Diff line change
@@ -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;
@@ -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);
}
}
12 changes: 7 additions & 5 deletions src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java
Original file line number Diff line number Diff line change
@@ -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;
@@ -17,6 +16,7 @@
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.At.Shift;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@@ -40,8 +40,9 @@ abstract class MixinWorldRenderer implements IWorldRenderer {

private List<ChunkMesh> nd$chunkMeshes;

// Inject before first instruction inside if(needsUpdate) block
@Inject(method = {"updateRenderer"},
at = @At(value = "HEAD"),
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/WorldRenderer;needsUpdate:Z", ordinal = 0),
require = 1)
private void preUpdateRenderer(CallbackInfo ci) {
preUpdateRenderer(false);
@@ -67,8 +68,9 @@ private void preUpdateRenderer(boolean sort) {
}
}

// Inject after last instruction inside if(needsUpdate) block
@Inject(method = {"updateRenderer"},
at = @At(value = "RETURN"),
at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/WorldRenderer;isInitialized:Z", ordinal = 0, shift = Shift.AFTER),
require = 1)
private void postUpdateRenderer(CallbackInfo ci) {
postUpdateRenderer(false);
@@ -110,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);
}
}
@@ -120,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();
}

29 changes: 27 additions & 2 deletions src/main/java/makamys/neodymium/renderer/NeoRenderer.java
Original file line number Diff line number Diff line change
@@ -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;
@@ -14,6 +13,7 @@
import makamys.neodymium.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumChatFormatting;
@@ -146,6 +146,10 @@ public int preRenderSortedRenderers(int renderPass, double alpha, WorldRenderer[
sort(frameCount % 100 == 0, frameCount % Config.sortFrequency == 0);

initIndexBuffers();

if(!Compat.keepRenderListLogic() && !Compat.isFalseTweaksModPresent()) {
updateRenderGlobalStats();
}
}

frameCount++;
@@ -206,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.isSpeedupAnimationsEnabled() && !Compat.keepRenderListLogic()) {
// Hodgepodge hooks this method to decide what animations to play, make sure it runs
wr.getGLCallListForPass(i);
}
@@ -233,6 +237,27 @@ private boolean shouldRenderMesh(Mesh mesh) {
}
return false;
}

private static void updateRenderGlobalStats() {
// Normally renderSortedRenderers does this, but we cancelled it

RenderGlobal rg = Minecraft.getMinecraft().renderGlobal;

for(WorldRenderer wr : rg.sortedWorldRenderers) {
if(wr != null) {
++rg.renderersLoaded;
if (wr.skipRenderPass[0]) {
++rg.renderersSkippingRenderPass;
} else if (!wr.isInFrustum) {
++rg.renderersBeingClipped;
} else if (rg.occlusionEnabled && !wr.isVisible) {
++rg.renderersBeingOccluded;
} else {
++rg.renderersBeingRendered;
}
}
}
}

private void mainLoop() {
if (Minecraft.getMinecraft().playerController.netClientHandler.doneLoadingTerrain) {
8 changes: 8 additions & 0 deletions src/main/resources/META-INF/neodymium_at.cfg
Original file line number Diff line number Diff line change
@@ -16,3 +16,11 @@ public net.minecraft.client.renderer.Tessellator field_78409_u #drawMode
public net.minecraft.client.renderer.Tessellator field_78408_v #xOffset
public net.minecraft.client.renderer.Tessellator field_78407_w #yOffset
public net.minecraft.client.renderer.Tessellator field_78417_x #zOffset

public net.minecraft.client.renderer.RenderGlobal field_72751_K # renderersLoaded
public net.minecraft.client.renderer.RenderGlobal field_72744_L # renderersBeingClipped
public net.minecraft.client.renderer.RenderGlobal field_72745_M # renderersBeingOccluded
public net.minecraft.client.renderer.RenderGlobal field_72746_N # renderersBeingRendered
public net.minecraft.client.renderer.RenderGlobal field_72747_O # renderersSkippingRenderPass
public net.minecraft.client.renderer.RenderGlobal field_72774_t # occlusionEnabled
public net.minecraft.client.renderer.RenderGlobal field_72768_k # sortedWorldRenderers
8 changes: 6 additions & 2 deletions updatejson/update.json
Original file line number Diff line number Diff line change
@@ -17,9 +17,13 @@
"0.1.8.5": "",
"0.1.9": "",
"0.2": "",
"0.2.1": ""
"0.2.1": "",
"0.2.2": "",
"0.2.3": "",
"0.2.4": "",
"0.2.5": ""
},
"promos": {
"1.7.10-latest": "0.2.1"
"1.7.10-latest": "0.2.5"
}
}