Dayanto Posted April 11, 2013 Posted April 11, 2013 Hello! I'm thinking of porting my mod to Forge but in order to do that, I first need to know if it's possible in the first place. I've done a bit of research and some digging in the JavaDoc but I haven't found the specific things I'm looking for, so I thought it would be better to ask someone with a bit of experience with Forge instead. To give you a bit of background: The mod I'm developing is called PanoramaKit and it is used to create backgrounds for the main menu as well as - you guessed it - panoramas. It does this by rotating the player and capturing a series of images that together make up everything that is around you. (360 x 180 degrees) There are mainly three things that I need for my mod to work properly. * A hook that runs once every frame. This is necessary for the rendering. * Preventing the player from moving the view (while the mod is capturing images). * The ability to offset the camera from the player. Reveal hidden contents There is a slight camera offset caused by the following lines of code which is a bit of a trouble. ... 487 else 488 { 489 GL11.glTranslatef(0.0F, 0.0F, -0.1F); 490 } ... This means that the player actually always walks around slightly like in 3rd person mode. Now this doesn't matter at all while you're playing but it causes the images not to fit together. In my mod currently, I don't want to break compatibility with mods that are using the EntityRenderer class, I use an approach where I correct the offset by moving the camera at a later time (via a special hook). // Undo player rotation GL11.glRotatef(-player.rotationYaw, 0, 1, 0); GL11.glRotatef(-player.rotationPitch, 1, 0, 0); // Correct camera position GL11.glTranslatef(0.0F, 0.0F, 0.1F); // Redo player rotation GL11.glRotatef(player.rotationYaw, 0, 1, 0); GL11.glRotatef(player.rotationPitch, 1, 0, 0); Most likely, the approach with Forge would be similar, but Forge doesn't have to think about compatibility as much, so perhaps there is a better way of controlling the camera already built in? (I don't expect to find any hook similar to the one I'm currently using, so this would probably be my only hope) (*) As a last thing, if there is a way to roll the camera, that would also be good to know but it's not essential for the mod. Quote
opssemnik Posted April 12, 2013 Posted April 12, 2013 i know there is a hook but i dont remember the name, do some search (if u dont find, u can always use asm). Quote
Dayanto Posted April 14, 2013 Author Posted April 14, 2013 On 4/12/2013 at 9:10 PM, opssemnik said: i know there is a hook but i dont remember the name, do some search (if u dont find, u can always use asm). Ok, I'll keep looking. (Is this what you mean by asm?) Out of the three, I was pretty much expecting the hook to exist. (I had to know for sure though) The other two however are my main concern. If you happen to know anything about them, it would help a lot. Edit: I rewrote the original post a bit to make it clearer. Quote
SanAndreaP Posted April 15, 2013 Posted April 15, 2013 On 4/14/2013 at 6:22 PM, Dayanto said: Quote i know there is a hook but i dont remember the name, do some search (if u dont find, u can always use asm). Ok, I'll keep looking. (Is this what you mean by asm?) Out of the three, I was pretty much expecting the hook to exist. (I had to know for sure though) The other two however are my main concern. If you happen to know anything about them, it would help a lot. Edit: I rewrote the original post a bit to make it clearer. For the first issue, you can use the ITickHandler (or the IScheduledTickHandler). Just set its TickType to TickType.RENDER and register it on the Client-side! Here's a tutorial on how to create one: Quote Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter Quote This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
Dayanto Posted April 16, 2013 Author Posted April 16, 2013 Sounds great! Thanks to both of you for the help! Quote
Dayanto Posted April 16, 2013 Author Posted April 16, 2013 Sounds great! Thanks to both of you for the help! 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.