_vertig0 Posted December 8, 2018 Posted December 8, 2018 Been googling a while on this one but got no help whatsoever. I know you can create another viewport and render it onto a GUI that the player can see. But I have no idea how to create a new Camera or viewport or whatever you wish to call it and display what it captures as one continuous feed. The GUI part was ok, but the camera part is what I cannot figure out. Sorry if this is a noob question as this is my first time with Forge. It's 1.11.2 if that helps Quote
V0idWa1k3r Posted December 8, 2018 Posted December 8, 2018 52 minutes ago, _vertig0 said: It's 1.11.2 if that helps Why? You should update to 1.12.2 The camera is usually a collection of 2 things - the viewprojection matrix and the frustrum. The ViewProjection matrix is a combination of a View matrix and a Projection matrix (as evident by name). The view matrix governs how vertices are transformed based on the position and the rotation of your "camera", or a view entity, or whatever it is, and the projection matrix governs how vertices are transformed based on the FOV, the aspect ratio and the width and the height of a viewport. This matrix is the minimal information that defines a basic camera. You can go without a frustrum but you must have the viewprojection matrix. There are helper methods that allow you to construct both the view and the projection matrices in the lwjgl library and then you just multiply them together to get the viewprojection matrix. However I unfortunately don't know whether the matrices in lwjgl are row-major or colomn-major so I can't tell you the order in which you multiply them. The frustrum is a collection of 6 planes defined by the viewprojection matrix used to do "culling" - basically not rendering anything that the camera can't see anyway. So here is the theory. In practice minecraft still uses old opengl for it's shaders and so you have to tell opengl which matrix to use. To do so you would need to first specify the viewport(the rectangle that defines, well, the viewport, the area of the screen the rendering takes place within) using GlStateManager.viewport. Then you switch to a GL_PROJECTION matrix mode with GlStateManager.matrixMode and load your projection matrix. Then switch to the GL_MODEL_VIEW matrix mode and load your view matrix. You load the matrix using GL11.glLoadMatrix, or set the matrix to identity with GlStateManager.loadIdentity and then multiply it by respective matrix using GlStateManager.glMultMatrix. However this topic of yours will require you to use a framebuffer aswell. You can ask me more about using that but it is a pretty advanced topic, even with minecraft helpfully providing the Framebuffer class. 1 Quote
_vertig0 Posted December 9, 2018 Author Posted December 9, 2018 9 hours ago, V0idWa1k3r said: Why? You should update to 1.12.2 The camera is usually a collection of 2 things - the viewprojection matrix and the frustrum. The ViewProjection matrix is a combination of a View matrix and a Projection matrix (as evident by name). The view matrix governs how vertices are transformed based on the position and the rotation of your "camera", or a view entity, or whatever it is, and the projection matrix governs how vertices are transformed based on the FOV, the aspect ratio and the width and the height of a viewport. This matrix is the minimal information that defines a basic camera. You can go without a frustrum but you must have the viewprojection matrix. There are helper methods that allow you to construct both the view and the projection matrices in the lwjgl library and then you just multiply them together to get the viewprojection matrix. However I unfortunately don't know whether the matrices in lwjgl are row-major or colomn-major so I can't tell you the order in which you multiply them. The frustrum is a collection of 6 planes defined by the viewprojection matrix used to do "culling" - basically not rendering anything that the camera can't see anyway. So here is the theory. In practice minecraft still uses old opengl for it's shaders and so you have to tell opengl which matrix to use. To do so you would need to first specify the viewport(the rectangle that defines, well, the viewport, the area of the screen the rendering takes place within) using GlStateManager.viewport. Then you switch to a GL_PROJECTION matrix mode with GlStateManager.matrixMode and load your projection matrix. Then switch to the GL_MODEL_VIEW matrix mode and load your view matrix. You load the matrix using GL11.glLoadMatrix, or set the matrix to identity with GlStateManager.loadIdentity and then multiply it by respective matrix using GlStateManager.glMultMatrix. However this topic of yours will require you to use a framebuffer aswell. You can ask me more about using that but it is a pretty advanced topic, even with minecraft helpfully providing the Framebuffer class. I think i get what you're saying, draw a rectangle using the GL helper methods, and with the above methods collect the area which is to be rendered, then transfer it using something called a FrameBuffer to the GUI? I think I could do my own homework, but one question, what is a FrameBuffer? I haven't done any rendering at all so am completely clueless on this Quote
V0idWa1k3r Posted December 9, 2018 Posted December 9, 2018 4 hours ago, _vertig0 said: draw a rectangle using the GL helper methods, and with the above methods collect the area which is to be rendered, then transfer it using something called a FrameBuffer to the GUI? Actually it's the reverse. First create the framebuffer, bind it, setup the matrices and the viewport and render your stuff. Then use the resulting texture in your GUI. Framebuffers are opengl's way of "offscreen rendering". Instead of drawing onto the main draw buffer you would draw onto a custom framebuffer which results in a texture you can render somewhere else. 1 Quote
_vertig0 Posted December 11, 2018 Author Posted December 11, 2018 On 12/9/2018 at 2:46 PM, V0idWa1k3r said: Actually it's the reverse. First create the framebuffer, bind it, setup the matrices and the viewport and render your stuff. Then use the resulting texture in your GUI. Framebuffers are opengl's way of "offscreen rendering". Instead of drawing onto the main draw buffer you would draw onto a custom framebuffer which results in a texture you can render somewhere else. I did try all that and unfortunately got stuck at the first part. I went and joined a world, marking my location. I saved it as coordinates in the mod (double type variables), but set the Y-Coordinate to 30 blocks higher than where I was, and saved pitch as a 90 degree face down value (The Camera is supposed to be pointing directly downwards), and then I went back to the mod... And got stuck on pretty much the first OpenGL function The GlStateManager class gives 4 parameters for the viewport function, all integers. I've no clue on what these are supposed to mean (Can't be coordinates, that's the View Matrix as you said earlier) Also if I'm not wrong that would be the point if this were a full fledged game where normally you would draw the graphics onto a display, right? Except this time it's on a Framebuffer? And if I want to move the Camera I have to constantly update the ViewProjection Matrix? Sorry for the constant annoying question. This isn't my forte Quote
V0idWa1k3r Posted December 11, 2018 Posted December 11, 2018 4 minutes ago, _vertig0 said: The GlStateManager class gives 4 parameters for the viewport function, all integers. I've no clue on what these are supposed to mean (Can't be coordinates, that's the View Matrix as you said earlier) You are mixing two different things. Viewport != view matrix. On 12/8/2018 at 7:40 PM, V0idWa1k3r said: specify the viewport(the rectangle that defines, well, the viewport, the area of the screen the rendering takes place within) 5 minutes ago, _vertig0 said: Also if I'm not wrong that would be the point if this were a full fledged game where normally you would draw the graphics onto a display, right? Except this time it's on a Framebuffer? And if I want to move the Camera I have to constantly update the ViewProjection Matrix? There is no difference between rendering to a framebuffer or rendering to the draw buffer. Yes, if you do want to move the camera you will have to update the matrices, but minecraft will do it for you if you simply want to render everything a second time since you will have to invoke the drawing entry method and it does everything for you. Quote
_vertig0 Posted December 12, 2018 Author Posted December 12, 2018 23 hours ago, V0idWa1k3r said: You are mixing two different things. Viewport != view matrix. There is no difference between rendering to a framebuffer or rendering to the draw buffer. Yes, if you do want to move the camera you will have to update the matrices, but minecraft will do it for you if you simply want to render everything a second time since you will have to invoke the drawing entry method and it does everything for you. Ah, I think you misunderstood what I said. I know the matrix and viewport are 2 different things, I was asking what the 4 parameters in the viewport function stood for. I am aware the matrix is the one responsible for the transformation logic and all that. I apologize for that. But if I guess correctly, the 4 int parameters in GlStateManager.viewport() are the 2D x-y coordinates for the on screen rectangle? So following that, if I want the whole screen to be captured on the camera, I put the coords of one extreme side in the first 2 parameters, and the coords of the other point at the extreme end Also by drawing entry method do you mean the method that renders to the Framebuffer? Quote
V0idWa1k3r Posted December 12, 2018 Posted December 12, 2018 10 minutes ago, _vertig0 said: I put the coords of one extreme side in the first 2 parameters, and the coords of the other point at the extreme end You put in the coords that define the rendering rectangle within the window. If you want the whole window to be rendered then it becomes [0, 0, Width, Height]. 11 minutes ago, _vertig0 said: by drawing entry method do you mean the method that renders to the Framebuffer? I mean the method that the game invokes to draw everything that is not a UI element - world, entities, items in player's hands, etc.. 1 Quote
_vertig0 Posted December 13, 2018 Author Posted December 13, 2018 (edited) Quote I mean the method that the game invokes to draw everything that is not a UI element - world, entities, items in player's hands, etc.. @Override public void initGui() { super.initGui(); GlStateManager.viewport(0, 0, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); GlStateManager.matrixMode(GL11.GL_PROJECTION); FloatBuffer projection = GLAllocation.createDirectFloatBuffer(16); GlStateManager.getFloat(GL11.GL_PROJECTION_MATRIX, projection); GL11.glLoadMatrix(projection); GlStateManager.matrixMode(GL11.GL_MODELVIEW); //GL11.glLoadMatrix(View Matrix???); } Managed to use the default Minecraft projection Matrix (In FloatBuffer form since LWJGL apparently only supports that and not the actual Matrix itself) as the projection matrix for the custom Camera using a bit of a hack, but how would I create the View Matrix? The View Matrix defines the Camera position and rotation as you said, so I can't just take the default Minecraft View Matrix and slap it into the Camera as I want to set it at a specific position and control it's movement as well. (Also tried looking for the LWJGL Matrix Methods and found none :((. All I found were Matrix4f in LWJGL and Minecraft's own personal Matrix4f class) Edited December 13, 2018 by _vertig0 Quote
V0idWa1k3r Posted December 13, 2018 Posted December 13, 2018 Why are you doing that in initGui? Rendering must happen every frame. Setting up the matrices is a part of rendering. Why are you just grabbing the projection matrix from GL? You can't do that, you need to construct one yourself. Besides you don't actually need to do any of this since as I've said On 12/11/2018 at 5:35 PM, V0idWa1k3r said: if you do want to move the camera you will have to update the matrices, but minecraft will do it for you if you simply want to render everything a second time since you will have to invoke the drawing entry method and it does everything for you. Quote
_vertig0 Posted December 13, 2018 Author Posted December 13, 2018 (edited) 2 hours ago, V0idWa1k3r said: Why are you doing that in initGui? Rendering must happen every frame. Setting up the matrices is a part of rendering. Why are you just grabbing the projection matrix from GL? You can't do that, you need to construct one yourself. Besides you don't actually need to do any of this since as I've said So the creation of the Matrices must happen every time the draw method is called? So if I got that right I just have to make an identity matrix or a blank one and then call the draw method (Framebuffer method?) and Minecraft will do the rest for me? Edit: Could you give a bit of a code demo since I'm getting a little confused here Edited December 13, 2018 by _vertig0 Quote
V0idWa1k3r Posted December 14, 2018 Posted December 14, 2018 On 12/13/2018 at 9:02 AM, _vertig0 said: So the creation of the Matrices must happen every time the draw method is called? So if I got that right I just have to make an identity matrix or a blank one On 12/13/2018 at 7:37 AM, V0idWa1k3r said: minecraft will do it for you if you simply want to render everything a second time since you will have to invoke the drawing entry method and it does everything for you. In your case you do not need to change the matrices if I understand your intentions correctly. You need to create a Framebuffer somewhere(just not each frame, please, ideally not even within your initGui method) then bind it, then render everything again by looking up what the game does to render the world and invoking those methods again. Then you grab the texture from your framebuffer, bind it, bind the default framebuffer and render the quad you need. On 12/13/2018 at 9:02 AM, _vertig0 said: Could you give a bit of a code demo since I'm getting a little confused here Pseudo-code: Framebuffer fbo; // Must run on the Gl thread void clientInit() { fbo = new Framebuffer(width, height, true); } // In your GUI void draw() { Framebuffer lastFBO = Minecraft.getMinecraft().getFramebuffer(); fbo.bind(); // Draw the world ... if (lastFBO != null) { lastFBO.bind(); } else { OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); } fbo.bindFramebufferTexture(); //Draw your quad ... } Quote
_vertig0 Posted December 14, 2018 Author Posted December 14, 2018 24 minutes ago, V0idWa1k3r said: In your case you do not need to change the matrices if I understand your intentions correctly. You need to create a Framebuffer somewhere(just not each frame, please, ideally not even within your initGui method) then bind it, then render everything again by looking up what the game does to render the world and invoking those methods again. Then you grab the texture from your framebuffer, bind it, bind the default framebuffer and render the quad you need. Pseudo-code: Framebuffer fbo; // Must run on the Gl thread void clientInit() { fbo = new Framebuffer(width, height, true); } // In your GUI void draw() { Framebuffer lastFBO = Minecraft.getMinecraft().getFramebuffer(); fbo.bind(); // Draw the world ... if (lastFBO != null) { lastFBO.bind(); } else { OpenGlHelper.glBindFramebuffer(OpenGlHelper.GL_FRAMEBUFFER, 0); } fbo.bindFramebufferTexture(); //Draw your quad ... } Nice! Thanks for helping with that. I've stopped trying to use direct LWJGL classes and GlStateManager to create the camera and I'm now looking at the Minecraft Source for how the In Game Camera works... Strangely only one class holds the x, y and z values for the Camera but numerous classes, including several mobs and the player class itself contain the pitch and yaw variables for the camera. And the Minecraft class contains a variable called renderViewEntity, which is the mob the camera is in, while another class named RenderSorter has a baseEntity field which also contains the entity the camera is in... Looks like I have some digging to do. I'll get back with the results after trying Edit: Blimey, Eclipse broke down for the third time this week. Well that sucks Quote
Cadiboo Posted December 14, 2018 Posted December 14, 2018 Have you tried IntelliJ? Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
_vertig0 Posted December 14, 2018 Author Posted December 14, 2018 5 hours ago, V0idWa1k3r said: You need to create a Framebuffer somewhere(just not each frame, please, ideally not even within your initGui method) then bind it, then render everything again by looking up what the game does to render the world and invoking those methods again. Then you grab the texture from your framebuffer, bind it, bind the default framebuffer and render the quad you need. What I managed to figure from this is: 1. On Client Start: Create a Framebuffer 2. Every time the update method for the GUI is called: Call bind method on my own framebuffer Call the minecraft render method with custom camera coordinates and pitch yaw values Bind back the default minecraft framebuffer before all hell breaks loose and graphics start spazzing out Collect image captured on my framebuffer Draw image on GUI and profit (Draw your quad does refer to drawing on the GUI, right?) And this way I don't have to touch any matrices at all? Quote
V0idWa1k3r Posted December 14, 2018 Posted December 14, 2018 3 minutes ago, _vertig0 said: 2. Every time the update method for the GUI is called: Not the update, the draw. Update happens each tick. Draw happens each frame. 4 minutes ago, _vertig0 said: Call the minecraft render method with custom camera coordinates and pitch yaw values If by "custom camera coordinates and pitch yaw values" you mean "change the renderEntity to a custom one with the desired coordinates and pitch/yaw" then yes, that is correct. 5 minutes ago, _vertig0 said: Draw image on GUI and profit (Draw your quad does refer to drawing on the GUI, right?) Yes, but you will have to draw using BufferBuilder directly. 6 minutes ago, _vertig0 said: And this way I don't have to touch any matrices at all? Pretty much, yes. Unless you want to render the world from an orthographic perspective for one reason or another. Quote
_vertig0 Posted December 15, 2018 Author Posted December 15, 2018 23 hours ago, V0idWa1k3r said: If by "custom camera coordinates and pitch yaw values" you mean "change the renderEntity to a custom one with the desired coordinates and pitch/yaw" then yes, that is correct. Hmm, you just gave me an interesting idea. Is there a way to spawn entities entirely client side only? I mean, if this was single player it would be easy, but if the client the mod is installed on was connected to a server, can the mod spawn a mob that only exists on the client, but not on the server? If so, I could just set the renderViewEntity field in the Minecraft class rather than having to go through the trouble of Framebuffers in the first place Quote
V0idWa1k3r Posted December 15, 2018 Posted December 15, 2018 4 hours ago, _vertig0 said: Is there a way to spawn entities entirely client side only? You do not need to spawn the renderViewEntity you are changing the camera to, it just needs to exist as an object. It doesn't need to be added to the world's lists or anything since you do not care for it ticking. 4 hours ago, _vertig0 said: If so, I could just set the renderViewEntity field in the Minecraft class rather than having to go through the trouble of Framebuffers in the first place Sorry to dissappoint but the "trouble of Framebuffers" exists so you can render the world to a texture to later use in your GUI. Changing the renderViewEntity has zero effect on using or not using framebuffers. Quote
_vertig0 Posted December 16, 2018 Author Posted December 16, 2018 21 hours ago, V0idWa1k3r said: You do not need to spawn the renderViewEntity you are changing the camera to, it just needs to exist as an object. It doesn't need to be added to the world's lists or anything since you do not care for it ticking. Sorry to dissappoint but the "trouble of Framebuffers" exists so you can render the world to a texture to later use in your GUI. Changing the renderViewEntity has zero effect on using or not using framebuffers. I just tried with a zombie and it friggin worked!! But then after 1 second the camera started just spazzing out. Do you happen to know what could cause this? Quote
V0idWa1k3r Posted December 16, 2018 Posted December 16, 2018 Did you reset the renderViewEntity to the player after you are done? Quote
_vertig0 Posted December 16, 2018 Author Posted December 16, 2018 4 minutes ago, V0idWa1k3r said: Did you reset the renderViewEntity to the player after you are done? oh well, basically i didn't use a GUI at all because i deemed it too much of a hassle, so i just set the renderViewEntity to Client Side Zombie and had that as a camera until the player hit the "G" key and set their view back to the normal player vision (By right the mod is supposed to be toggleable between a constant video feed from a camera elsewhere and the normal player vision). But it just spazzed out when the renderViewEntity was set to a Zombie. Tried this on both on singleplayer world and on a server (I chose Mineplex out of convenience). In both cases the zombie definitely spawned as I got it's viewpoint, but then it spazzed out like mad. Interestingly when I looked at where I was supposed to be from the camera as it spazzed out (As in the physical player) I could only see my shadow, the player model itself was gone Quote
V0idWa1k3r Posted December 16, 2018 Posted December 16, 2018 I am unable to replicate your issue in my test setup. You are either changing the render view entity to a new one every frame/tick or your zombie's head is just rotating all over the place for one reason or another. Quote
_vertig0 Posted December 16, 2018 Author Posted December 16, 2018 12 minutes ago, V0idWa1k3r said: I am unable to replicate your issue in my test setup. You are either changing the render view entity to a new one every frame/tick or your zombie's head is just rotating all over the place for one reason or another. The strange part however is that it's verifiably not the zombie's head that's spinning all over the place. A quick coordinates check reveals that the zombies head is always facing 90 degrees downwards and is yawed at 0, and these values don't change at all. It's not that I'm changing the renderViewEntity every frame either, I instantiate the zombie once and that's it. The toggle button only fires once per press (I confirmed it by adding debug messages) I even made the mod disable my mouse to make sure it wasn't a problem with the mouse and the view was still spazzing all over the place. I'll try to get a video tomorrow when I have my PC available Quote
_vertig0 Posted December 17, 2018 Author Posted December 17, 2018 23 hours ago, V0idWa1k3r said: I am unable to replicate your issue in my test setup. You are either changing the render view entity to a new one every frame/tick or your zombie's head is just rotating all over the place for one reason or another. Got the video: (Had to upload as a youtube video) Here are all my classes: package com.snipermod.forgeclient; import org.lwjgl.input.Keyboard; import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.ItemBow; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.event.FMLInitializationEvent; @Mod(clientSideOnly = true, name = ArrowDirector.MODNAME, modid = ArrowDirector.MODID, version = ArrowDirector.VERSION, acceptedMinecraftVersions = ArrowDirector.ACCEPTED_MINECRAFT_VERSIONS) public class ArrowDirector { public static final String MODID = "forgeclient"; public static final String VERSION = "1.0"; public static final String MODNAME = "snipermod"; public static final String ACCEPTED_MINECRAFT_VERSIONS = "[1.11.2]"; boolean overhead = false; @Instance public static ArrowDirector mod; public KeyBinding key = new KeyBinding("Toggle Key", Keyboard.KEY_G, "key.categories.misc"); public static final boolean isMultiplayer = !Minecraft.getMinecraft().isSingleplayer(); @EventHandler public void init(FMLInitializationEvent event) { System.out.println("Initialising Forge Mod"); ClientRegistry.registerKeyBinding(key); MinecraftForge.EVENT_BUS.register(new MEventHandler()); Minecraft.getMinecraft().mouseHelper = new ForgeMouseWrapper(); } public static boolean hasBowEquipped() { return Minecraft.getMinecraft().player.getHeldItemMainhand().getItem() instanceof ItemBow; } public void update() { if(ArrowDirector.hasBowEquipped() == false) { Minecraft.getMinecraft().setRenderViewEntity(Minecraft.getMinecraft().player); this.overhead = false; if(Minecraft.getMinecraft().mouseHelper instanceof ForgeMouseWrapper) { ForgeMouseWrapper forgeMouse = (ForgeMouseWrapper) Minecraft.getMinecraft().mouseHelper; forgeMouse.isPlayerRotationDisabled = false; } } ForgeMouseWrapper forgeMouse; if(Minecraft.getMinecraft().mouseHelper instanceof ForgeMouseWrapper) { forgeMouse = (ForgeMouseWrapper) Minecraft.getMinecraft().mouseHelper; } /* To do in the code block in this area: * Update the Camera position on mouse move * Update target location * Restrict any movement if the bow is not pulled or is pulled * too little to launch an arrow * Do NOT allow mod to perform calculation if arrow will not launch */ } } package com.snipermod.forgeclient; import java.util.UUID; import com.mojang.authlib.GameProfile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; public class ClientViewPlayer extends EntityPlayer { public ClientViewPlayer(World world) { super(world, new GameProfile(UUID.fromString("41C82C87-7AfB-4024-BA57-13D2C99CAE77"), "[Minecraft]")); } @Override public void onUpdate() { return; } @Override public void onLivingUpdate() { return; } @Override public void onEntityUpdate() { return; } @Override public boolean isCreative() { return false; } @Override public boolean isSpectator() { return false; } } package com.snipermod.forgeclient; import org.lwjgl.input.Mouse; import net.minecraft.util.MouseHelper; public class ForgeMouseWrapper extends MouseHelper { boolean isPlayerRotationDisabled = false; int secretMouseX; int secretMouseY; @Override public void mouseXYChange() { if(!isPlayerRotationDisabled) { super.mouseXYChange(); } else { this.secretMouseX = Mouse.getDX(); this.secretMouseY = Mouse.getDY(); } } } package com.snipermod.forgeclient; import net.minecraft.client.Minecraft; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; public class MEventHandler { private final ArrowDirector instance = ArrowDirector.mod; ClientViewPlayer view = null; @SubscribeEvent public void onKeypress(KeyInputEvent event) { if(instance.key.isPressed()) { if(ArrowDirector.hasBowEquipped() == false) return; if(!instance.overhead) { if(view == null) { view = new ClientViewPlayer(Minecraft.getMinecraft().player.world); } view.setLocationAndAngles(Minecraft.getMinecraft().player.posX, Minecraft.getMinecraft().player.posY + 10.0D, Minecraft.getMinecraft().player.posZ, Minecraft.getMinecraft().player.rotationYawHead, 90); view.world = Minecraft.getMinecraft().player.world; Minecraft.getMinecraft().setRenderViewEntity(view); } else if(instance.overhead) { Minecraft.getMinecraft().setRenderViewEntity(Minecraft.getMinecraft().player); } instance.overhead = !instance.overhead; if(Minecraft.getMinecraft().mouseHelper instanceof ForgeMouseWrapper) { ForgeMouseWrapper forgeMouse = (ForgeMouseWrapper) Minecraft.getMinecraft().mouseHelper; forgeMouse.isPlayerRotationDisabled = instance.overhead; } } } @SubscribeEvent public void onTick(ClientTickEvent event) { if(instance.overhead) { instance.update(); } } } For the life of me I can't figure out what's wrong. Nothing else is malfunctioning in the mod, everything works smoothly- Except for the spazzing out camera feed Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.