From eb9f755b54e2d267302404fcaa2bc46c1b640b64 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 21 Feb 2019 10:03:03 -0800 Subject: [PATCH] disable rendercachedchunks in singleplayer, fixes #331 --- .../baritone/launch/mixins/MixinChunkRenderContainer.java | 2 +- .../java/baritone/launch/mixins/MixinChunkRenderWorker.java | 3 ++- src/launch/java/baritone/launch/mixins/MixinRenderChunk.java | 5 +++-- src/launch/java/baritone/launch/mixins/MixinRenderList.java | 3 ++- .../java/baritone/launch/mixins/MixinVboRenderList.java | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java index 511e1c14..0fc81487 100644 --- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java +++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java @@ -41,7 +41,7 @@ public class MixinChunkRenderContainer { ) ) private BlockPos getPosition(RenderChunk renderChunkIn) { - if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null && Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) { GlStateManager.enableAlpha(); GlStateManager.enableBlend(); GL14.glBlendColor(0, 0, 0, Baritone.settings().cachedChunksOpacity.get()); diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java index a8247a9b..2bd1521c 100644 --- a/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java +++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderWorker.java @@ -20,6 +20,7 @@ package baritone.launch.mixins; import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.utils.IPlayerContext; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.chunk.ChunkRenderWorker; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -42,7 +43,7 @@ public abstract class MixinChunkRenderWorker { ) ) private boolean isChunkExisting(ChunkRenderWorker worker, BlockPos pos, World world) { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java index 4190ae59..754f523f 100644 --- a/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java +++ b/src/launch/java/baritone/launch/mixins/MixinRenderChunk.java @@ -21,6 +21,7 @@ import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.utils.IPlayerContext; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.chunk.RenderChunk; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ChunkCache; @@ -46,7 +47,7 @@ public class MixinRenderChunk { if (!chunkCache.isEmpty()) { return false; } - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { @@ -75,7 +76,7 @@ public class MixinRenderChunk { ) ) private IBlockState getBlockState(ChunkCache chunkCache, BlockPos pos) { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { Baritone baritone = (Baritone) BaritoneAPI.getProvider().getPrimaryBaritone(); IPlayerContext ctx = baritone.getPlayerContext(); if (ctx.player() != null && ctx.world() != null && baritone.bsi != null) { diff --git a/src/launch/java/baritone/launch/mixins/MixinRenderList.java b/src/launch/java/baritone/launch/mixins/MixinRenderList.java index 3d4d8a91..e2f0ae90 100644 --- a/src/launch/java/baritone/launch/mixins/MixinRenderList.java +++ b/src/launch/java/baritone/launch/mixins/MixinRenderList.java @@ -18,6 +18,7 @@ package baritone.launch.mixins; import baritone.Baritone; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderList; import org.spongepowered.asm.mixin.Mixin; @@ -37,7 +38,7 @@ public class MixinRenderList { ) ) private void popMatrix() { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { // reset the blend func to normal (not dependent on constant alpha) GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); } diff --git a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java index 70048c8c..f51d2234 100644 --- a/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java +++ b/src/launch/java/baritone/launch/mixins/MixinVboRenderList.java @@ -18,6 +18,7 @@ package baritone.launch.mixins; import baritone.Baritone; +import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.VboRenderList; import org.spongepowered.asm.mixin.Mixin; @@ -37,7 +38,7 @@ public class MixinVboRenderList { ) ) private void popMatrix() { - if (Baritone.settings().renderCachedChunks.get()) { + if (Baritone.settings().renderCachedChunks.get() && Minecraft.getMinecraft().getIntegratedServer() == null) { // reset the blend func to normal (not dependent on constant alpha) GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); }