Jump to content

Updating 1.8 tessellator into 1.9 and up


Checkium

Recommended Posts

7 minutes ago, V0idWa1k3r said:

Ehh.. What? It is fired each frame, as any other render event. 

I don't really get the 'player can be assigned later' bit too. Assigned to what? RenderLivingEvent only fires for entities which are, well, drawn on screen. The entity object you get in that event can't be null. And as far as I am aware MC will not render players on the client (and thus will not call the event) untill the full data but the skin has been recieved for that player. And if you really need it you can even wait for the skin to be recieved with a simple if check...

 

I do not see the


startDrawingESPs

method, but I assume it simply renders the AABB you've provided. You are not offsetting enough. Say your entity is at 20 10 10. And the player is at -20 10 10. Right now you are translating the tessellator to 0 0 0... and rendering the box there. You know, at 0, yourEntityOffsetY, 0. Why are you not applying the X and Z entity coordintes to your aabb?

Also your minY and maxY coordinates are the same for your aabb. Unless you are handling that differently in your render function that will not work.

With player can be assigned later I mean that I will asign players for the box to render later, so it need to be fired afterwards.

 

This is my startDrawingESPs method:

public static void startDrawingESPs(AxisAlignedBB bb, float r, float b, float g)
{
    GL11.glPushMatrix();
    GL11.glEnable(3042);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1.5F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glDisable(2929);
    GL11.glDepthMask(false);
    GL11.glColor4d(r, b, g, 0.185F);
    drawBoundingBox(bb);
    GL11.glColor4d(r, b, g, 1.0F);
    drawOutlinedBoundingBox(bb);
    GL11.glLineWidth(2.0F);
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(2929);
    GL11.glDepthMask(true);
    GL11.glDisable(3042);
    GL11.glPopMatrix();
}

DrawBoundingBox method:

Spoiler

public static void drawBoundingBox(AxisAlignedBB axisalignedbb)
{

    VertexBuffer tessellator = Tessellator.getInstance().getBuffer();
    Tessellator tessellatorr = Tessellator.getInstance();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellatorr.draw();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellatorr.draw();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellatorr.draw();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellatorr.draw();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellatorr.draw();
    tessellator.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.minZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ).endVertex();
    tessellator.pos(axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ).endVertex();
    tessellatorr.draw();
}

 

DrawOutlinedBoundingBox Method

Spoiler

public static void drawOutlinedBoundingBox(AxisAlignedBB par1AxisAlignedBB)
{
    VertexBuffer var2 = Tessellator.getInstance().getBuffer();
    Tessellator tessellator = Tessellator.getInstance();

    var2.begin(3, DefaultVertexFormats.POSITION_TEX);
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex();
    tessellator.draw();
    var2.begin(3, DefaultVertexFormats.POSITION_TEX);
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex();
    tessellator.draw();
    var2.begin(1, DefaultVertexFormats.POSITION_TEX);
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.minZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.maxX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.minY, par1AxisAlignedBB.maxZ).endVertex();
    var2.pos(par1AxisAlignedBB.minX, par1AxisAlignedBB.maxY, par1AxisAlignedBB.maxZ).endVertex();
    tessellator.draw();
}

 
Edited by Checkium
Link to comment
Share on other sites

Yes, you need to specify your AABB correctly. With appropriate XYZ coordinates. Something like (posX - 0.5, posY, posZ - 0.5, posX + 0.5, posY + offsetY, posZ + 0.5)

 

Your vertexformat is position + texture coordinates yet you are only providing the position to your vertex. Why does your format even include texture coordinates if you are disabling the texture units with OpenGL in the first place? :D

 

Also you do not need to call draw every n vertices. You can upload all your vertices first and then call the draw method. 

  • Like 1
Link to comment
Share on other sites

4 minutes ago, V0idWa1k3r said:

Yes, you need to specify your AABB correctly. With appropriate XYZ coordinates. Something like (posX - 0.5, posY, posZ - 0.5, posX + 0.5, posY + offsetY, posZ + 0.5)

 

Your vertexformat is position + texture coordinates yet you are only providing the position to your vertex. Why does your format even include texture coordinates if you are disabling the texture units with OpenGL in the first place? :D

 

Also you do not need to call draw every n vertices. You can upload all your vertices first and then call the draw method. 

So, I fixed the AABB, and now its like this:

K0GIiO6.png

I didn't get the part about the vertex texture thing, could you explain better?

Link to comment
Share on other sites

I don't think you have fixed it as it is still clearly following the player with some of it's vertices.

You should really use the RenderLivingEvent to not suffer with translations that much as it already has everything figured, you would just use the X/Y/Z it provides.

 

VertexFormat is a way to tell OpenGL what data do your vertices carry. Like position. Or color. Or texture coordinates.

When you start drawing with Tessellator's VertexBuffer you specify the format - the way vertices are packed. You should then follow that format when declaring your vertices. If your format is POSITION_TEX which is basically position followed by texture coordinates your vertices should include both (pos(xyz).tex(uv)). If you are not planning to use texture coordinates don't use the format which includes them. There is a POSITION format which only requires position. Or POSITION_COLOR.

Edited by V0idWa1k3r
  • Like 1
Link to comment
Share on other sites

3 minutes ago, V0idWa1k3r said:

I don't think you have fixed it as it is still clearly following the player with some of it's vertices.

You should really use the RenderLivingEvent to not suffer with translations that much as it already has everything figured, you would just use the X/Y/Z it provides.

 

VertexFormat is a way to tell OpenGL what data do your vertices carry. Like position. Or color. Or texture coordinates.

When you start drawing with Tessellator's VertexBuffer you specify the format - the way vertices are packed. You should then follow that format when declaring your vertices. If your format is POSITION_TEX which is basically position followed by texture coordinates your vertices should include both (pos(xyz).tex(uv)). If you are not planning to use texture coordinates don't use the format which includes them. There is a POSITION format which only requires position. Or POSITION_COLOR.

I think i'm finally getting somewhere :D

aF7YC9K.png

Link to comment
Share on other sites

12 minutes ago, V0idWa1k3r said:

I don't think you have fixed it as it is still clearly following the player with some of it's vertices.

You should really use the RenderLivingEvent to not suffer with translations that much as it already has everything figured, you would just use the X/Y/Z it provides.

 

VertexFormat is a way to tell OpenGL what data do your vertices carry. Like position. Or color. Or texture coordinates.

When you start drawing with Tessellator's VertexBuffer you specify the format - the way vertices are packed. You should then follow that format when declaring your vertices. If your format is POSITION_TEX which is basically position followed by texture coordinates your vertices should include both (pos(xyz).tex(uv)). If you are not planning to use texture coordinates don't use the format which includes them. There is a POSITION format which only requires position. Or POSITION_COLOR.

Ok so, I got the box working :D

Is there any way to be able to control the box? Like, change its colors or remove it anytime I want? Maybe making some color variables and using them in the event?

Link to comment
Share on other sites

2 minutes ago, V0idWa1k3r said:

Pretty much something like that, yea. The particular implementation is up to you

Also, a slightly thing I wanna change if its not hard:
The box currently keeps teleporting around wich is annyoing me, is it possible to make it move smoother, and would it be hard? 

Also, how can I make the box don't show for myself?

Edited by Checkium
Link to comment
Share on other sites

You mean when in third person view? Just check that the entity you are drawing the box around isn't the client player.

Define 'teleporting around'. It is already translated using partial ticks so it should move smooth with the entity it is drawn around. If that entity is being teleported then the box is obviously going to follow the entity.

Link to comment
Share on other sites

3 minutes ago, V0idWa1k3r said:

You mean when in third person view? Just check that the entity you are drawing the box around isn't the client player.

Define 'teleporting around'. It is already translated using partial ticks so it should move smooth with the entity it is drawn around. If that entity is being teleported then the box is obviously going to follow the entity.

It was a bug, it only happens when the box is on you, wich I will disable so no problem.

Thanks for all the help man <3

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • LOGIN DAN DAFTAR DISINI CEPAT!! AYUTOGEL adalah situs judi online yang memudahkan para pemainnya, dengan menggunakan deposit pulsa terbilang cukup memudahkan para pemainnya dikarenakan setiap orang pasti bisa mengisi pulsa di mana pun dengan agen agen pulsa, dengan mudah di dapat kan dimana mana jika para pemain tidak memiliki e-money atau m-banking anda tidak perlu khawatir lagi di karenakan AYUTOGEL adalah situs slot deposit pulsa. Slot Deposit pulsa adalah sebuah situs judi slot online yang melayani deposit menggunakan transfer pulsa atau menggunakan pulsa ponsel yang tersedia.
    • DAFTAR DAN LOGIN DISINI   Hantogel atau handogel adalah bentuk pengumpulan duka uang yang populer di dunia judi online, khususnya dalam permainan slot gacor. Banyak situs judi online yang menawarkan handogel slot gacor, dan sebagai pemain, penting untuk mengetahui cara memilih dan mengakses situs tersebut dengan aman dan amanah. Dalam artikel ini, kami akan membahas cara memilih situs slot gacor online yang berkualitas dan tahu cara mengakses handogelnya.
    • DAFTAR & LOGIN SIRITOGEL Siritogel adalah kumpulan kata yang mungkin baru saja dikenal oleh masyarakat, namun dengan perkembangan teknologi dan banyaknya informasi yang tersedia di internet, kalau kita siritogel (mencari informasi dengan cara yang cermat dan rinci) tentang situs slot gacor online, maka kita akan menemukan banyak hal yang menarik dan membahayakan sama sekali. Dalam artikel ini, kita akan mencoba menjelaskan apa itu situs slot gacor online dan bagaimana cara mengatasi dampaknya yang negatif.
    • This honestly might just work for you @SubscribeEvent public static void onScreenRender(ScreenEvent.Render.Post event) { final var player = Minecraft.getInstance().player; final var options = Minecraft.getInstance().options; if(!hasMyEffect(player)) return; // TODO: You provide hasMyEffect float f = Mth.lerp(event.getPartialTick(), player.oSpinningEffectIntensity, player.spinningEffectIntensity); float f1 = ((Double)options.screenEffectScale().get()).floatValue(); if(f <= 0F || f1 >= 1F) return; float p_282656_ = f * (1.0F - f1); final var p_282460_ = event.getGuiGraphics(); int i = p_282460_.guiWidth(); int j = p_282460_.guiHeight(); p_282460_.pose().pushPose(); float f5 = Mth.lerp(p_282656_, 2.0F, 1.0F); p_282460_.pose().translate((float)i / 2.0F, (float)j / 2.0F, 0.0F); p_282460_.pose().scale(f5, f5, f5); p_282460_.pose().translate((float)(-i) / 2.0F, (float)(-j) / 2.0F, 0.0F); float f4 = 0.2F * p_282656_; float f2 = 0.4F * p_282656_; float f3 = 0.2F * p_282656_; RenderSystem.disableDepthTest(); RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); p_282460_.setColor(f4, f2, f3, 1.0F); p_282460_.blit(new ResourceLocation("textures/misc/nausea.png"), 0, 0, -90, 0.0F, 0.0F, i, j, i, j); p_282460_.setColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.defaultBlendFunc(); RenderSystem.disableBlend(); RenderSystem.depthMask(true); RenderSystem.enableDepthTest(); p_282460_.pose().popPose(); }   Note: Most of this is directly copied from GameRenderer as you pointed out you found. The only thing you'll have to likely do is update the `oSpinningEffectIntensity` + `spinningEffectIntensity` variables on the player when your effect is applied. Which values should be there? Not 100% sure, might be a game of guess and check, but `handleNetherPortalClient` in LocalPlayer has some hard coded you might be able to start with.
    • Dalam dunia perjudian online yang berkembang pesat, mencari platform yang dapat memberikan kemenangan maksimal dan hasil terbaik adalah impian setiap penjudi. OLXTOTO, dengan bangga, mempersembahkan dirinya sebagai jawaban atas pencarian itu. Sebagai platform terbesar untuk kemenangan maksimal dan hasil optimal, OLXTOTO telah menciptakan gelombang besar di komunitas perjudian online. Satu dari banyak keunggulan yang dimiliki OLXTOTO adalah koleksi permainan yang luas dan beragam. Dari togel hingga slot online, dari live casino hingga permainan kartu klasik, OLXTOTO memiliki sesuatu untuk setiap pemain. Dibangun dengan teknologi terkini dan dikembangkan oleh para ahli industri, setiap permainan di platform ini dirancang untuk memberikan pengalaman yang tak tertandingi bagi para penjudi. Namun, keunggulan OLXTOTO tidak hanya terletak pada variasi permainan yang mereka tawarkan. Mereka juga menonjol karena komitmen mereka terhadap keamanan dan keadilan. Dengan sistem keamanan tingkat tinggi dan proses audit yang ketat, OLXTOTO memastikan bahwa setiap putaran permainan berjalan dengan adil dan transparan. Para pemain dapat merasa aman dan yakin bahwa pengalaman berjudi mereka di OLXTOTO tidak akan terganggu oleh masalah keamanan atau keadilan. Tak hanya itu, OLXTOTO juga terkenal karena layanan pelanggan yang luar biasa. Tim dukungan mereka selalu siap sedia untuk membantu para pemain dengan segala pertanyaan atau masalah yang mereka hadapi. Dengan respon cepat dan solusi yang efisien, OLXTOTO memastikan bahwa pengalaman berjudi para pemain tetap mulus dan menyenangkan. Dengan semua fitur dan keunggulan yang ditawarkannya, tidak mengherankan bahwa OLXTOTO telah menjadi pilihan utama bagi jutaan penjudi online di seluruh dunia. Jika Anda mencari platform yang dapat memberikan kemenangan maksimal dan hasil optimal, tidak perlu mencari lebih jauh dari OLXTOTO. Bergabunglah dengan OLXTOTO hari ini dan mulailah petualangan Anda menuju kemenangan besar dan hasil terbaik!
  • Topics

×
×
  • Create New...

Important Information

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