diff options
Diffstat (limited to 'src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java')
-rw-r--r-- | src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java | 72 |
1 files changed, 1 insertions, 71 deletions
diff --git a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java index 997ac67..a45257f 100644 --- a/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java +++ b/src/main/java/makamys/neodymium/mixin/MixinWorldRenderer.java @@ -3,46 +3,28 @@ package makamys.neodymium.mixin; import java.util.ArrayList; import java.util.List; -import org.lwjgl.opengl.GL11; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import makamys.neodymium.Config; import makamys.neodymium.Neodymium; import makamys.neodymium.ducks.IWorldRenderer; import makamys.neodymium.renderer.ChunkMesh; import makamys.neodymium.renderer.NeoRenderer; -import makamys.neodymium.renderer.lod.FarChunkCache; -import makamys.neodymium.renderer.lod.FarWorldRenderer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.ChunkCache; -import net.minecraft.world.World; /** Inserts hooks in WorldRenderer to listen for changes, and to grab the tessellator data right before rendering. */ @Mixin(WorldRenderer.class) abstract class MixinWorldRenderer implements IWorldRenderer { @Shadow - public int posX; - @Shadow - public int posY; - @Shadow - public int posZ; - - @Shadow private boolean isInFrustum; @Shadow public boolean[] skipRenderPass; - @Shadow - private int glRenderList; @Shadow public boolean needsUpdate; @@ -52,22 +34,6 @@ abstract class MixinWorldRenderer implements IWorldRenderer { public List<ChunkMesh> chunkMeshes; - @Redirect(method = "setPosition", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderAABB(Lnet/minecraft/util/AxisAlignedBB;)V")) - private void redirectRenderAABB(AxisAlignedBB p1) { - if(!FarWorldRenderer.class.isInstance(this.getClass())) { - RenderItem.renderAABB(p1); - } - } - - @Redirect(method = "updateRenderer", at = @At(value = "NEW", target = "Lnet/minecraft/world/ChunkCache;")) - private ChunkCache redirectConstructChunkCache(World p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) { - if(!FarWorldRenderer.class.isInstance(this.getClass())) { - return new ChunkCache(p1, p2, p3, p4, p5, p6, p7, p8); - } else { - return new FarChunkCache(p1, p2, p3, p4, p5, p6, p7, p8); - } - } - @Inject(method = "updateRenderer", at = @At(value = "HEAD")) private void preUpdateRenderer(CallbackInfo ci) { saveDrawnStatus(); @@ -101,49 +67,13 @@ abstract class MixinWorldRenderer implements IWorldRenderer { @Inject(method = "postRenderBlocks", at = @At(value = "HEAD")) private void prePostRenderBlocks(int pass, EntityLivingBase entity, CallbackInfo ci) { - if(insideUpdateRenderer && Neodymium.isActive() && !Config.disableChunkMeshes) { + if(insideUpdateRenderer && Neodymium.isActive()) { if(chunkMeshes != null) { chunkMeshes.add(ChunkMesh.fromTessellator(pass, WorldRenderer.class.cast(this), Tessellator.instance)); } } } - @Redirect(method = "postRenderBlocks", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/Tessellator;draw()I")) - private int redirectPostRenderBlocksDraw() { - if(!FarWorldRenderer.class.isInstance(this.getClass())) { - return Tessellator.instance.draw(); - } else { - Tessellator.instance.reset(); - return 0; - } - } - - // There's probably a nicer way to do this - - @Redirect(method = "postRenderBlocks", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glPopMatrix()V")) - private void redirectPostRenderBlocksGL1() { - if(!FarWorldRenderer.class.isInstance(this.getClass())) { - GL11.glPopMatrix(); - } - } - - @Redirect(method = "postRenderBlocks", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/GL11;glEndList()V")) - private void redirectPostRenderBlocksGL2() { - if(!FarWorldRenderer.class.isInstance(this.getClass())) { - GL11.glEndList(); - } - } - - // XXX this is inconsistent, Forge callbacks are preserved in postRenderBlocks but not preRenderBlocks - - @Inject(method = "preRenderBlocks", at = @At(value = "HEAD")) - private void preRenderBlocksInjector(CallbackInfo ci) { - if(FarWorldRenderer.class.isInstance(this.getClass())) { - Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ)); - ci.cancel(); - } - } - @Inject(method = "setDontDraw", at = @At(value = "HEAD")) private void preSetDontDraw(CallbackInfo ci) { if(Neodymium.isActive()) { |