Jump to content

[1.14.4] render slider on container screen


andGarrett

Recommended Posts

6 hours ago, andGarrett said:

how would I render the slider on my container screen?

Any way you want?...

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

6 minutes ago, andGarrett said:

I mean what class and/or method is used to display moving images.

You render something moving by changing the x and y value while rendering nothing else there is no special method or class. You have to implement it yourself.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

13 hours ago, Animefan8888 said:

You render something moving by changing the x and y value while rendering nothing else there is no special method or class. You have to implement it yourself.

how exactly do I render the image though? I don't know how to render an image at all. I know how to draw strings with "this.font.drawString()", and I've tried "this.minecraft.getTextureManager().bindTexture();", but that seems incorrect.

Link to comment
Share on other sites

7 minutes ago, andGarrett said:

and I've tried "this.minecraft.getTextureManager().bindTexture();", but that seems incorrect.

Why does that seem incorrect? It binds a texture to be used by the rendering engine. Then you need to tell it what part of the texture to render where. Take a look at how you render your gui backgrounds.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

On 10/4/2019 at 3:43 PM, Animefan8888 said:

Take a look at how you render your gui backgrounds.

I did.

 

from my container screen:

    @Override
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
        GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.minecraft.getTextureManager().bindTexture(GUI);
        int relX = (this.width - this.xSize) / 2;
        int relY = (this.height - this.ySize) / 2;
        this.blit(relX, relY, 0, 0, this.xSize, this.ySize);
    }

 

"GlStateManager" is 1300 lines of mostly obfuscated code.

 

"this.minecraft.getTextureManager().bindTexture(GUI)" creates an "ITextureObject" within the Texture maneger. I'm not sure what an "ITextureObject" does, and, looking at the code, would take a lot of trial-and-error to figure out how to use if I'm even capable. after creating the ITextureObject, bindTexture() has the line "this.loadTexture(resource, itextureobject)". loadTexture() is pretty hard to understand just looking at the code.

 

the next three lines revolve around "this.blit()", which leads me to more obfuscated code.

 

There are many rabbit holes I could spend hours upon hours looking down. I've already spent a few hours looking for the answers myself as well as experimenting with the code. I was hoping someone on the forum might be able to either point me to an explanation or give a short one themselves.

Link to comment
Share on other sites

3 minutes ago, andGarrett said:

I was hoping someone on the forum might be able to either point me to an explanation or give a short one themselves.

What are you looking through those methods for? TextureManager#bindTexture binds the texture you want to OpenGL then Gui/Screen#blit takes the bound texture and renders it to the screen by giving OpenGL vertices. This is exactly what you want. Now to make it move change the relX and relY variables every tick and use partialTicks to interpolate it.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

35 minutes ago, Animefan8888 said:

What are you looking through those methods for?

are you kidding? when I don't understand something, I look through the associated methods and classes. That should be the first thing a person does. Then I experiment. Then I look online for an answer/explanation. finally I post here on the forums.

 

half the time when I post on this forum I get negativity. I assumed it was because I wasn't being diligent enough in figuring things out on my own. I spend HOURS trying to get something to work before asking here because I don't want to annoy people like yourself. Why, you ask, am I looking through those methods? to not bother you. to not get the negativity. An impossible task it seems.

Link to comment
Share on other sites

1 minute ago, andGarrett said:

An impossible task it seems.

I wasn't intending to be negative. I was wondering what information you were trying to gleam from that method. What about it did you want to know?

2 minutes ago, andGarrett said:

when I don't understand something, I look through the associated methods and classes.

I wanted to know what you didn't understand.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

22 minutes ago, Animefan8888 said:

I wasn't intending to be negative.

 

here is your first reply on this thread.

On 10/4/2019 at 1:45 AM, Animefan8888 said:

Any way you want?...

you end the reply with "...". Correct me if I'm wrong, but in most contexts that would indicate annoyance or loosing ones patience. "Any way you want?", is like asking "isn't it obvious?", which does nothing to help while also being backhanded.

 

so you intentionally asked a backhanded question ended with "..." to indicate annoyance. you typed all this out deliberately.

 

to be fair, you are not the only one who does this kind of thing. I would not be typing all this out if it were the first time I saw something like this, and you were the only one. If you truly had no idea that you were being negative, then I'm sorry for all this. All I want is to learn, without stepping on any toes.

Link to comment
Share on other sites

4 minutes ago, andGarrett said:

here is your first reply on this thread.

I meant to convey confusion with that. I apologize that it came off as annoyance or me loosing my patience. Though I do loose my patience on here with some people and do get annoyed by some as well. I can't say I've ever had that experience with you. But back to your problem what was it you were trying to learn from that section of code? If you are still trying to accomplish rendering a moveable image. Then you bind the texture to OpenGL with TextureManager#bindTexture and then if you are in a Gui/Screen use blit. Specify the values it asks for like you would render your background of the gui.

 

2 hours ago, andGarrett said:

this.blit(relX, relY, 0, 0, this.xSize, this.ySize);

So the parameters for this blit method is where on the screen x,y then where in the image x,y then the width and height to render it to the screen.

 

There are more versions of blit which allow you to customize various things. One limitation of the above method is that it only works with 256x256 images. Another one is you can't scale up or down the size of the image.

  • Thanks 2

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.