Jump to content

Porting my mod (Does Forge have what it needs?)


Dayanto

Recommended Posts

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.

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

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

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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.