|
23 | 23 | import clientapi.event.defaults.game.render.RenderWorldEvent; |
24 | 24 | import net.minecraft.block.material.Material; |
25 | 25 | import net.minecraft.block.state.IBlockState; |
| 26 | +import net.minecraft.client.Minecraft; |
26 | 27 | import net.minecraft.client.gui.GuiIngame; |
27 | 28 | import net.minecraft.client.renderer.EntityRenderer; |
| 29 | +import net.minecraft.client.renderer.GlStateManager; |
| 30 | +import org.spongepowered.asm.mixin.Final; |
28 | 31 | import org.spongepowered.asm.mixin.Mixin; |
| 32 | +import org.spongepowered.asm.mixin.Shadow; |
29 | 33 | import org.spongepowered.asm.mixin.injection.At; |
30 | 34 | import org.spongepowered.asm.mixin.injection.Inject; |
31 | 35 | import org.spongepowered.asm.mixin.injection.Redirect; |
32 | 36 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
33 | 37 |
|
34 | 38 | import static net.minecraft.block.material.Material.AIR; |
35 | 39 | import static net.minecraft.block.material.Material.WATER; |
36 | | -import static org.spongepowered.asm.lib.Opcodes.GETFIELD; |
| 40 | +import static org.lwjgl.opengl.GL11.GL_MODELVIEW; |
| 41 | +import static org.lwjgl.opengl.GL11.GL_PROJECTION; |
| 42 | +import static org.spongepowered.asm.lib.Opcodes.GETSTATIC; |
37 | 43 |
|
38 | 44 | /** |
39 | 45 | * @author Brady |
|
42 | 48 | @Mixin(EntityRenderer.class) |
43 | 49 | public class MixinEntityRenderer { |
44 | 50 |
|
| 51 | + @Shadow @Final private Minecraft mc; |
| 52 | + |
45 | 53 | @Inject( |
46 | 54 | method = "updateCameraAndRender", |
47 | 55 | at = @At( |
48 | 56 | value = "FIELD", |
49 | | - opcode = GETFIELD, |
| 57 | + opcode = GETSTATIC, |
50 | 58 | target = "net/minecraft/client/renderer/OpenGlHelper.shadersSupported:Z", |
51 | 59 | shift = At.Shift.BEFORE |
52 | 60 | ) |
53 | 61 | ) |
54 | 62 | private void updateCameraAndRender(float partialTicks, long nanoTime, CallbackInfo ci) { |
| 63 | + GlStateManager.pushMatrix(); |
| 64 | + |
| 65 | + // Setup orthogonal projection for display size |
| 66 | + GlStateManager.matrixMode(GL_PROJECTION); |
| 67 | + GlStateManager.loadIdentity(); |
| 68 | + GlStateManager.ortho(0.0D, mc.displayWidth, mc.displayHeight, 0.0D, 1000.0D, 3000.0D); |
| 69 | + GlStateManager.matrixMode(GL_MODELVIEW); |
| 70 | + GlStateManager.loadIdentity(); |
| 71 | + GlStateManager.translate(0.0F, 0.0F, -2000.0F); |
| 72 | + GlStateManager.viewport(0, 0, mc.displayWidth, mc.displayHeight); |
| 73 | + |
55 | 74 | ClientAPI.EVENT_BUS.post(new RenderScreenEvent(partialTicks)); |
| 75 | + |
| 76 | + GlStateManager.popMatrix(); |
56 | 77 | } |
57 | 78 |
|
58 | 79 | @Inject( |
|
0 commit comments