Jump to content

[1.7.10] Need help finding code responsible for updating screen.


Recommended Posts

Posted

Okay so we all know how ResourcePack GUI look like (yeah, this list).

Now: If you would try to resize MC window the list-boxes will stay aligned to center and top/bottom.

 

Since I am basing on code provided by Vanilla: GuiListExtended (extending it)

I would like to know wth GuiResourcePackList updates it's alignment without calling ANYTHING inside drawScreen().

 

For whole code:

 

 

GuiResourcePackList extends GuiListExtended

used in: GuiScreenResourcePacks

contains: ResourcePackListEntry

 

 

I am using exact same practice based on provided interfaces.

 

Exact parts:

 

 

GuiScreenResourcePacks#initGui()

Gui element is defined, initialized and aligned (sized and stuff)

        this.field_146970_i = new GuiResourcePackAvailable(this.mc, 200, this.height, this.field_146966_g);
        this.field_146970_i.setSlotXBoundsFromLeft(this.width / 2 - 4 - 200);

GuiScreenResourcePacks#drawScreen()

public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
    {
        this.drawBackground(0);
        this.field_146970_i.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
        this.field_146967_r.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
        this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.title", new Object[0]), this.width / 2, 16, 16777215);
        this.drawCenteredString(this.fontRendererObj, I18n.format("resourcePack.folderInfo", new Object[0]), this.width / 2 - 77, this.height - 26, 8421504);
        super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
    }

But as you can see - IT'S NEVER updated - I want to know what is responsible for updating size of that element (list), couldn't find literally anything.

For now I was able to overcome it partially by calling:

setSlotXBoundsFromLeft(int x)

Inside MyGuiScreen#drawScreen(), but this is just X position, I have to call a lot of alignment stuff inside drawing method if I want to make everything look like ResourcePackList does. And that's is NOT what Vanilla does, since there is NOTHING updating inside GuiScreen parent of this list elements.

 

 

 

Note: To help me here you would actually have to look deeper in code (or know your shit better than me) :)

 

1.7.10 is no longer supported by forge, you are on your own.

Posted

So anyone looked/will look into that? I was searching (also debugging) code with 2 other ppl alredy and we can't find anything inside those classes, there must be something working (influencing those values) from the outside or something VERY small that we missed it.

1.7.10 is no longer supported by forge, you are on your own.

Posted

initGui is called whenever the screen is resized.

 

width=300 height=164http://img-9gag-lol.9cache.com/photo/a9MYVrj_460sa_v1.gif[/img]

 

This is me right now:

http://img-9gag-ftw.9cache.com/photo/a1ZNggP_460sv_v1.mp4

 

Checked everything, for about 2 years was SURE as hell that init is called only once (after constructor) or when you recall it on your own, but NO!

THANK YOU! (That also means that MC code is once again VERY (not) optimised... but what did I expect.

 

Oh and why it didn't work for me: (in initGui())

if (this.myList == null)
	//init list

So basically I did something MC doesn't.

1.7.10 is no longer supported by forge, you are on your own.

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.