Jump to content

[1.10.2][CLOSED]Creating Non Existing Blocks


Kaneka

Recommended Posts

Hi everyone,

 

I am thinking of adding something more complicated and dont know how to do it.

I want to add a non existing block which marks blocks that needs to be removed by the player, like clicking on a button and see which blocks need to be removed, that the tileentity have enought space to go on. Like marking the blocks, that needs to be removed with a red X or something like this. It should not change the blocks at all.

 

Hope it is understandable.

 

Thanks for your answers,

 

Kaneka

Link to comment
Share on other sites

Likely you need to subscribe to one of the rendering events and draw some additional geometry in the locations you wish it to appear.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

It is an entity because it does not change the block.

You are looking for something that is invisible with a red x in the middle of it, or just a plain red x for your entity model.

You are looking for something with lifetime.

You are also looking for something that doesn't move when summoned (like a firework)

 

this is just a possibility...

 

the only way I know to create "phantom" or non existing but existing blocks is if you open about 3 or 4 browsers. (even 1 or 2 depending on your system)

Then open up minecraft. Then summon fallingsand entities at a straight flying linear type entity.

This will cause the phenomena (which sucks) because they don't act like air blocks... they act like some kind of glitchy spiderweb barrier block. you can't go through them.

Link to comment
Share on other sites

Hi

 

If you are looking for something like this:

then you'll probably find RenderWorldLastEvent event useful.

In the event, use the Tessellator to draw your markers, for example something along these lines, where the [x1,y1,z1] etc define the four corners of a square just in front of the face you're drawing, and you repeat this method for all faces of every cube you want to outline:

 

  public static void drawBoxWithCross(double x1, double x2, double x3, double x4,
                                      double y1, double y2, double y3, double y4,
                                      double z1, double z2, double z3, double z4)
  {
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldRenderer = tessellator.getWorldRenderer();
    worldRenderer.startDrawing(GL11.GL_LINE_STRIP);
    worldRenderer.addVertex(x1, y1, z1);
    worldRenderer.addVertex(x2, y2, z2);
    worldRenderer.addVertex(x3, y3, z3);
    worldRenderer.addVertex(x4, y4, z4);
    worldRenderer.addVertex(x1, y1, z1);
    tessellator.draw();

    worldRenderer.startDrawing(GL11.GL_LINES);
    worldRenderer.addVertex(x1, y1, z1);
    worldRenderer.addVertex(x3, y3, z3);
    worldRenderer.addVertex(x2, y2, z2);
    worldRenderer.addVertex(x4, y4, z4);
    tessellator.draw();
  }

That code was for 1.8 so it might be slightly different now, but it gives you the basic idea?

 

-TGG

 

Link to comment
Share on other sites

It has a different name in different versions. I think in 1.10 it's called VertexBuffer

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

  • 2 weeks later...

Is there a tutorial or a codeexample where I can see how to add rendering processes when pushing a button in a gui?

When button is pushed switch a boolean. Then when boolean is true and or false which ever you decide make stuff render.

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

ok, thanks.

Now I just need a tutorial or examplecode on how to make stuff render, cause all I found is just "how to texture blocks in 1.7", nothing about 1.10. I just need to render red crosses.

Do you know how the tesselator works?

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

Just what I read in the tutorials about the "texture block" tutorial, but not that much

First create a texture aka the one you want to draw. Once you have done that locate where you need to type the render code aka one of the rendering events. Use minecrafts texture manager to bund the texture you made. Then call GL11.translatef() to move the rendering to the block pos. Then use a tesselator to draw the image.

Note: I may be missing a step...

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

That was how to render a block, I just want to draw lines to make crosses to mark some existing blocks. best would be examplecode, but thanks for xou effort till here

The texture is the cross as tesselator (as far as i know) draws images and not "shapes".

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

Hi

 

If you are looking for something like this:

then you'll probably find RenderWorldLastEvent event useful.

In the event, use the Tessellator to draw your markers, for example something along these lines, where the [x1,y1,z1] etc define the four corners of a square just in front of the face you're drawing, and you repeat this method for all faces of every cube you want to outline:

 

  public static void drawBoxWithCross(double x1, double x2, double x3, double x4,
                                      double y1, double y2, double y3, double y4,
                                      double z1, double z2, double z3, double z4)
  {
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldRenderer = tessellator.getWorldRenderer();
    worldRenderer.startDrawing(GL11.GL_LINE_STRIP);
    worldRenderer.addVertex(x1, y1, z1);
    worldRenderer.addVertex(x2, y2, z2);
    worldRenderer.addVertex(x3, y3, z3);
    worldRenderer.addVertex(x4, y4, z4);
    worldRenderer.addVertex(x1, y1, z1);
    tessellator.draw();

    worldRenderer.startDrawing(GL11.GL_LINES);
    worldRenderer.addVertex(x1, y1, z1);
    worldRenderer.addVertex(x3, y3, z3);
    worldRenderer.addVertex(x2, y2, z2);
    worldRenderer.addVertex(x4, y4, z4);
    tessellator.draw();
  }

That code was for 1.8 so it might be slightly different now, but it gives you the basic idea?

 

-TGG

 

Isn´t this some way doing it? All I need to know is where to call this method, and what I need to do additionally to make it work.  I never worked with openGL or RenderWorldLastEvent. Thats my problem.

Link to comment
Share on other sites

WorldRenderer has become VertexBuffer and instead of addVertex it is the way diesieben said. You also must call vb.startDrawing(glnum, DefaultVertexFormats...) mess around with that last var because i do not know what it would be in this case.

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

Any examplecode for me?

For the tesselator? Look at Gui#drawTexturedModelRect(...) sadly I do not have any for this specific "idea".

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

Note that the drawing part is only one part of the problem you have to solve. The other part is knowing and remembering all the block positions that you have marked.

 

So first of all you will need to extend the players to have the ability to remember a List (or similar Java collection) of BlockPos locations that have been marked. In older versions you'd use IExtendedEntityProperties but I think now you would do this using a custom Capability. Make sure that however you store this, it gets synced between server and client (unless you don't mind if it is temporary in which case you could probably just do all the marking code on client).

 

I'm assuming maybe you will mark the blocks with a special tool. So you will need to make that tool item and then in the onUse() method of your item, if it has been used on a block, you would need to add the BlockPos to your list.

 

Only then can you really use the stuff you're discussing above to draw the X on the blocks.

 

Note also it can even get more complicated if you want to handle the case where a marked block gets deleted. Because you will then need to remove the BlockPos from the List, otherwise the air will continue to be marked. So instead of a List you might want to use a Map or similar where you index with BlockPos and record the type of block that was there -- then if that block changes in that location you can remove the entry from the Map.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Thanks for the detailed answer,

The blocks should be marked just temporarly.

I thought about the TESR doint this, cause the gui and the button should be connected to a tileentity.

Would this be to laggy, cause I dont need thet complex shapes, just the red crosses for a period of 10-20 seconds?

Link to comment
Share on other sites

Thanks for the detailed answer,

The blocks should be marked just temporarly.

I thought about the TESR doint this, cause the gui and the button should be connected to a tileentity.

Would this be to laggy, cause I dont need thet complex shapes, just the red crosses for a period of 10-20 seconds?

Is it your own blocks? Or is it Vanilla blocks? If it is the first one just use a blockstate that flips on when you press the button. With that there is no need to use events or A tesselator.

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.