diff --git a/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java new file mode 100644 index 00000000..49af7d72 --- /dev/null +++ b/src/launch/java/baritone/launch/mixins/MixinChunkRenderContainer.java @@ -0,0 +1,40 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see . + */ + +package baritone.launch.mixins; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ChunkRenderContainer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.chunk.RenderChunk; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(ChunkRenderContainer.class) +public class MixinChunkRenderContainer { + @Inject( + method = "preRenderChunk", + at = @At("HEAD") + ) + private void preRenderChunk(RenderChunk renderChunkIn, CallbackInfo ci) { + if (Minecraft.getMinecraft().world.getChunk(renderChunkIn.getPosition()).isEmpty()) { + GlStateManager.translate(0, Math.sin(System.currentTimeMillis() / 1000D + (renderChunkIn.getPosition().getX() + renderChunkIn.getPosition().getZ()) / 16D) * 4, 0); + } + } +} diff --git a/src/launch/resources/mixins.baritone.json b/src/launch/resources/mixins.baritone.json index 9a7dce45..10e3510d 100644 --- a/src/launch/resources/mixins.baritone.json +++ b/src/launch/resources/mixins.baritone.json @@ -13,6 +13,7 @@ "MixinChunkCache", "MixinChunkProviderClient", "MixinChunkProviderServer", + "MixinChunkRenderContainer", "MixinChunkRenderWorker", "MixinEntity", "MixinEntityLivingBase",