Jump to content

# [1.7.10]Render bar the other way round.

## Recommended Posts

i have a standart bar in minecraft

int expbar = (int) (((double) 194) * (rins.getCURRENTLEVELEXP()) / rins.getNEXTLEVELMAXEXP());

GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

drawTexturedModalRect(xPos -94, yPos - 32 + 3, 0, 9, expbar, 7);

this is going normal like the normal expbar of minecraft.

But how i can change the drawing from right to left    to left to right?

##### Share on other sites

1. calculate the size of the gui to draw

2. calculate the x where u want to start to draw (xmax-size)

3. draw the gui!

##### Share on other sites

can i draw  rect with minus widht and hight?

sorry my english is not so good...

##### Share on other sites

I cant find a way to solve this problem.

here is my bar

the 2 bars on top are render the same, but i want the left bar to render right to left.

can write so good english i hope you understand it.

##### Share on other sites

You should really learn tesselator (and math?) to understand the drawing process.

The method you are using now:

drawTexturedModalRect(xPos -94, yPos - 32 + 3, 0, 9, expbar, 7);

Is pretty much: Draw box from x/y, with width/height.

So logically, when width is your progress, the "walls" of box are at:

left: x

right: x+progress

top: y

bot: y+height

To draw in reverse you would need to have:

left: x+max-progress

right: x+max

top: y

bot: y+height

Converted to drawing:

drawTexturedModalRect(xPos + 194 - expbar, yPos - 29, 0, 9, expbar, 7);

But that is just plain stupid if you can easily learn tess and draw nice things, example:

```	wr.addVertex(right, top, zLevel); // top right corner
wr.addVertex(left, top, zLevel); // top left corner
wr.addVertex(left, bottom, zLevel); // bot left
wr.addVertex(right, bottom, zLevel); // bot right
```

This draws a box with said 4 corners. Since vertexes go anti-clockwise, you add them in this order. Look at "drawTexturedModalRect" on how to implement it, I leave it as an exerice.

Read more:

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

##### Share on other sites

thank you i think i understand it now, maybe i will draw it all with tessel now. i will try some stuff

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

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.

• ### Recently Browsing

• No registered users viewing this page.
• ### Posts

• Maybe it's just that my model is janked in some way? My .java model class file from blockbench doesn't have a render method, but every model from everyone who's had this issue in the past has had a render or doRender method that take different values than my models renderToBuffer method which requires the ever puzzling and mysterious vertexConsumer. But if that were the case, surely I'd have issues rendering mob entities with the model as well?
• Having the same problem, have you found a fix?
• If I make a new renderer class it seems it lets me use the render method off of that. But I have no idea how to get the context? Additionally, I'm not sure that even if I do get the context for the constructor it won't just red line out the render method again telling me "non static method can't be used in static context"   final EntityRendererProvider context = ??????; ToaPlayerRenderer h = new ToaPlayerRenderer(context, false); h.render(p, 1f,pTicks, stack, buffer, paLights); However, I feel like this isn't going to work even if I somehow figure out where to look to get context and the render method can actually be used
• Did you ever solve this issue? I have the exact same problem and no one seems to even bother to answer any question about this.
• I have already made custom dimensions and dimension_type, but I can't figure out how to make a world type.

• ### Who's Online (See full list)

• There are no registered users currently online
×

• #### Activity

×
• Create New...

## Important Information

By using this site, you agree to our Terms of Use.