-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Savestates] Fixed camera not being correctly applied after loadstate
- Loading branch information
1 parent
030e215
commit 1af74d5
Showing
3 changed files
with
44 additions
and
3 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/main/java/com/minecrafttas/tasmod/mixin/events/MixinEntityRenderer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.minecrafttas.tasmod.mixin.events; | ||
|
||
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.callback.CallbackInfo; | ||
|
||
import com.minecrafttas.mctcommon.events.EventListenerRegistry; | ||
import com.minecrafttas.tasmod.events.EventClient.EventDrawHotbarAlways; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.gui.ScaledResolution; | ||
import net.minecraft.client.renderer.EntityRenderer; | ||
import net.minecraft.client.renderer.GlStateManager; | ||
|
||
@Mixin(EntityRenderer.class) | ||
public class MixinEntityRenderer { | ||
|
||
@Shadow | ||
private Minecraft mc; | ||
|
||
@Inject(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/profiler/Profiler;endStartSection(Ljava/lang/String;)V")) | ||
public void inject_onRenderGameOverlay(CallbackInfo ci) { | ||
ScaledResolution scaledResolution = new ScaledResolution(this.mc); | ||
GlStateManager.clear(256); | ||
GlStateManager.matrixMode(5889); | ||
GlStateManager.loadIdentity(); | ||
GlStateManager.ortho(0.0, scaledResolution.getScaledWidth_double(), scaledResolution.getScaledHeight_double(), 0.0, 1000.0, 3000.0); | ||
GlStateManager.matrixMode(5888); | ||
GlStateManager.loadIdentity(); | ||
GlStateManager.translate(0.0F, 0.0F, -2000.0F); | ||
EventListenerRegistry.fireEvent(EventDrawHotbarAlways.class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters