Jump to content

Recommended Posts

Posted

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

Posted

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.

Posted

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.

Posted

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

 

Posted

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.

  • 2 weeks later...
Posted

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.

Posted

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.

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

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.

Posted

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.

Posted

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/

Posted

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?

Posted

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.

Posted

It should be all blocks, as i told in my first post, it should show which blocks needs to be removed before the machine can go on working, so it could be any block. vanilla, my mod or other mod.

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

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
  • Topics

×
×
  • Create New...

Important Information

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