Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] I was able to edit Vanilla .java source files until just recently


SoLegendary
 Share

Recommended Posts

I have only recently started modding using Forge, but I found very quickly that I was able to modify the vanilla source code directly by simply right clicking a classname -> Go to Declarations or Usages in IntelliJ.

This would open up the source .jar file at the path: \build\fg_cache\net\minecraftforge\forge\1.16.5-36.2.0_mapped_official_1.16.5\forge-1.16.5-36.2.0_mapped_official_source_1.16.5.jar which I could easily pull out of the .jar archive, edit with a notepad and throw back in. I was doing this to disable frustum culling in ClippingHelper.java (ie. rendering outside of the player's usual view) for a camera mod I was working on.

However, as of today making these changes seemed to suddenly have no effect. I saved the changes, deleted my .gradle and build folders, invalidated my caches and reran the gradlew genIntellijRuns to rebuild them and suddenly that source jar no longer exists and I cannot find any vanilla .java files anymore, only .class files which are not editable by text editor. My mod still runs perfectly fine, minus the changes to the ClippingHelper class I made of course.

So my questions are:

    Where did this source .jar go?
    Is there an alternative way to edit Vanilla .java source files like I was doing?
    Is there an alternative to editing Vanilla classes in the first place?

As proof I'm not crazy, I've attached the original ClippingHelper.java class below that I was previously able to find under that path.

https://pastebin.com/MvFtQaTH

 

 

 

Edited by SoLegendary
solved
Link to comment
Share on other sites

Do you know another method for editing the view frustum or disabling frustum culling entirely?

I've tried looking at Minecraft.levelRenderer as it has quite a few references to view frustums like capturedFrustum, viewArea, frustumPoints, frustumPos, except when I use the access transformer to make these public in order to read them, they all seem to be null or 0.

For some context, I've implemented an orthographic camera, but when it's zoomed out, you can see behind the player, which isn't rendered due to frustum culling:

ypx7ZQe.png

Increasing FOV helps somewhat, but I can only get it to a maximum of 180 (ie. a semicircle rendering cone) using the FOV modifier event before it just wraps around again. If there's a way to get it to 360 somehow that would also solve the issue.

Edited by SoLegendary
note about FOV
Link to comment
Share on other sites

capturedFrustum is an internal debug tool, which I don't think you can activate in the normal game. But you can abuse it here, because you can use it to overwrite the frustum.

In EntityViewRenderEvent.CameraSetup compute whatever frustum you want and set capturedFrustum to it. Then the game will use that frustum instead of whatever it computes based on player position.

Link to comment
Share on other sites

Actually I solved it a different way by just setting the camera entity to face downward above the ground and hard-setting the FOV to 180 to effectively render everything in range, then just manually offsetting the camera angle up by 45deg.

That said, this method would definitely improve performance a lot.

Thanks!

Link to comment
Share on other sites

  • SoLegendary changed the title to [SOLVED] I was able to edit Vanilla .java source files until just recently

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
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.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.