19MisterX98 / SeedcrackerX

MIT License
1.02k stars 103 forks source link

how do you render block outlines? #176

Open JanCantCode opened 1 year ago

JanCantCode commented 1 year ago

Not sure if this even belongs here, but ive been trying to realize how you can render blocks / block outlines using fabric, and ive allways failed lmao. any help?

JanCantCode commented 1 year ago

yes, i have seen https://github.com/19MisterX98/SeedcrackerX/tree/master/src/main/java/kaptainwutax/seedcrackerX/render but i dont reall see any rendering done in there

JanCantCode commented 1 year ago

after some more work, i found https://github.com/19MisterX98/SeedcrackerX/blob/master/src/main/java/kaptainwutax/seedcrackerX/finder/FinderQueue.java#L54 but i dont quite understand what that does

JanCantCode commented 1 year ago

ive been looking through this code for like literally 2 hours and have no idea what is happening lol

notpoiu commented 1 year ago

This code is used to render the outlines. The code checks the rendering setting from a configuration (Config.get().render), and if it's set to "OFF", the method returns immediately. The method uses a matrix stack and a camera to calculate the position of the player camera in the game world, and then uses the Tessellator and BufferBuilder to define and render lines with specific properties (width, blend mode, etc.) The method then renders each finder in the "finderControl" list if it should be rendered, and finally draws the lines and cleans up the rendering state.

19MisterX98 commented 1 year ago

Rendering in mc is messy and you probably shouldnt look at my code cause I am a noob in that kind of stuff aswell