aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java16
-rw-r--r--src/main/java/makamys/neodymium/renderer/NeoRenderer.java13
2 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java b/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java
index d38f491..f4d01ac 100644
--- a/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java
+++ b/src/main/java/makamys/neodymium/mixin/MixinRenderGlobal.java
@@ -2,6 +2,7 @@ package makamys.neodymium.mixin;
import org.spongepowered.asm.mixin.Mixin;
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.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -11,6 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import makamys.neodymium.Neodymium;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.WorldRenderer;
+import net.minecraft.entity.EntityLivingBase;
/** Blocks vanilla chunk rendering while NeoRenderer is active. */
@Mixin(RenderGlobal.class)
@@ -19,6 +21,9 @@ abstract class MixinRenderGlobal {
@Shadow
private WorldRenderer[] sortedWorldRenderers;
+ @Unique
+ private boolean isInsideUpdateRenderers;
+
@Redirect(method = "renderSortedRenderers", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderGlobal;renderAllRenderLists(ID)V"))
private void redirectRenderAllRenderLists(RenderGlobal thiz, int p1, double p2) {
if(Neodymium.shouldRenderVanillaWorld()) {
@@ -40,4 +45,15 @@ abstract class MixinRenderGlobal {
Neodymium.renderer = null;
}
}
+
+ @Inject(method = "updateRenderers", at = @At(value = "RETURN"))
+ public void postUpdateRenderers(EntityLivingBase entity, boolean flag, CallbackInfoReturnable<Boolean> cir) {
+ if(Neodymium.isActive() && !isInsideUpdateRenderers) {
+ isInsideUpdateRenderers = true;
+ for(int i = 0; i < Neodymium.renderer.rendererSpeedup; i++) {
+ ((RenderGlobal)(Object)this).updateRenderers(entity, flag);
+ }
+ isInsideUpdateRenderers = false;
+ }
+ }
}
diff --git a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
index 7a74141..03c7911 100644
--- a/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
+++ b/src/main/java/makamys/neodymium/renderer/NeoRenderer.java
@@ -49,6 +49,7 @@ public class NeoRenderer {
public boolean hasInited = false;
public boolean destroyPending;
public boolean reloadPending;
+ public int rendererSpeedup;
private static boolean[] wasDown = new boolean[256];
@@ -216,6 +217,13 @@ public class NeoRenderer {
if(Keyboard.isKeyDown(Keyboard.KEY_LEFT) && !wasDown[Keyboard.KEY_LEFT]) {
reloadPending = true;
}
+ if(Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && !wasDown[Keyboard.KEY_RIGHT]) {
+ if(rendererSpeedup == 0) {
+ rendererSpeedup = 300;
+ } else {
+ rendererSpeedup = 0;
+ }
+ }
}
for(int i = 0; i < 256; i++) {
wasDown[i] = Keyboard.isKeyDown(i);
@@ -558,6 +566,11 @@ public class NeoRenderer {
"Meshes: " + ChunkMesh.instances + " (" + ChunkMesh.usedRAM / 1024 / 1024 + "MB)",
"Rendered: " + renderedMeshes + " (" + renderedQuads / 1000 + "KQ)"
));
+ if(rendererSpeedup > 0) {
+ text.addAll(Arrays.asList(
+ "(!) Renderer speedup active"
+ ));
+ }
return text;
}