Modded Minecraft Reddit Feed
190 subscribers
32.7K photos
3.03K videos
4 files
36.3K links
This is a bot channel automatically posting content from /r/feedthebeast as it gets posted.

Supported by @r_channels & @reddit2telegram.
Download Telegram
what is this reward in FTB stoneblock 3
https://redd.it/1rhhihe
@MinecraftModded
Minecraft GUI code is the final boss of technical debt

Holy fucking shit, working with minecrafts ui in any way is just SO ASS. I just spent 6 hours in a void trying to do basic asf layout in 1.21.1. Why is it that THE MOST SUCCESSFULL GAME EVER has me manually bookkeeping Y-offsets like its 1995? There are no Elements, there is no hierarchy. Its just "render this shit now and forget it". I dont even know how tall my GUI is.


Dont even get me started on the GUI Scale setting. I spend time getting a button to be in the center, only to change my scale to Auto and suddenly my oh so centered button is at X=21,520


I decided to look at my own C# engine to remind myself what sanity looks like.


Minecraft:

//inside render()
int x = this.width / 2 - 360; //Hardcoded
int y = this.height / 2 - 240; //Hardcoded
drawTexture(stack, x, y, 0, 0, 720, 480); //just pixels on a screen. will be gone next frame

//30 lines later in mouseClicked()

if (mouseX >= this.width / 2 - 360 && mouseX <= this.width / 2 + 360...) {
// REPEAT THE MATH PERFECTLY OR THE BUTTON DOESN'T WORK
}


My Engine:

uiRenderer.Add(
new Window()
.SetName("Window")
.SetAnchor(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f)) //NO ABSOLUTE PIXEL BULLSHIT HERE BTW
.SetSize(720, 480)
.CenterInParent(720, 480) // The engine does the math, not me
.Create()
);

Minecraft GUI has no retained state, no hierarchy, no layout helpers, no relative coordinates unless calculated manually.

Even the vanilla creative menu doesnt actually scroll, instead its just a fixed 9x5 grid that replaces the ItemStack's inside those slots.

https://redd.it/1rhmyc6
@MinecraftModded
Star Technologies: Reasons to make aqueous accumulator?
https://redd.it/1rhyj2c
@MinecraftModded