Jump to content

Recommended Posts

Posted

I need to render a line kind of like the Immersive Engineering cables.

I tried to use Minecraft's RenderFish class as example, but I had no luck doing it.

 

  Reveal hidden contents
  Reveal hidden contents
  Reveal hidden contents

 

Posted
Posted

So I managed to render a line using RenderWorldLastEvent, but I have no idea how to store the TileEntities on client side.

  Reveal hidden contents

 

Posted
  On 8/18/2019 at 9:32 PM, xxTFxx said:

So I managed to render a line using RenderWorldLastEvent, but I have no idea how to store the TileEntities on client side.

  Reveal hidden contents

 

Expand  

Use packets to sync tile entity’s data from server to client.

 

  On 8/18/2019 at 9:36 AM, CAS_ual_TY said:

RenderWorldLastEvent together with a place to store the cables client side is what I would do.

Expand  

I would suggest making a TileEntityRenderer and do the rendering of cables there. Each tile entity would only renders its cables, therefore making another storage of cables unnecessary.

 

 

  • Thanks 1

Some tips:

  Reveal hidden contents

 

Posted

Can I do something, so the TileEntity renders the cable when I don't look at the TileEntity?

Or do I need to render the cables twice from each end.

Posted (edited)
  On 8/19/2019 at 2:59 PM, xxTFxx said:

Can I do something, so the TileEntity renders the cable when I don't look at the TileEntity?

Or do I need to render the cables twice from each end.

Expand  

Oof. You might be better off just querying the nearby area for all instances of your TE (there's a chunk TE cache, don't examine every block) and render all* the cables all the time. 

 

*I would only look at the 9 or 16 chunks directly around the player, if you have cables longer or farther away than that, fuck'em. (1) don't let cables be that long and (2) if they're that far away you don't need to be able to see them. Additionally you can cull any cables that aren't within 32 vertical blocks of the player as well (you'll need to write a check for this).  Culling for things behind the camera will be too difficult and not worth it.

Edited by Draco18s

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 (edited)
  On 8/19/2019 at 3:17 PM, Draco18s said:

*I would only look at the 9 or 16 chunks directly around the player, if you have cables longer or farther away than that, fuck'em. 

Expand  

That makes sense, but the problem is that TESR doesn't render the cable if I'm not looking at the TileEntity.

  Reveal hidden contents

 

Edited by xxTFxx
Posted

Well, of course, because TEs are culled when they are outside the view frustum. I was assuming that this was true:

  On 8/19/2019 at 12:58 AM, DavidM said:

So I managed to render a line using RenderWorldLastEvent

Expand  

You don't need to *store* the cables anywhere. Inside the event you get the world from the Minecraft instance, query the TE cache that already exists, find your TEs, get their cables, render them.

  • Thanks 1

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
  On 8/19/2019 at 2:59 PM, xxTFxx said:

Can I do something, so the TileEntity renders the cable when I don't look at the TileEntity?

Or do I need to render the cables twice from each end.

Expand  

Override TileEntity#getRenderBoundingBox and return NULL_AABB to make the tile entity render at all times (when you are not looking at it).

Some tips:

  Reveal hidden contents

 

Posted
  On 8/19/2019 at 11:34 PM, DavidM said:

Override TileEntity#getRenderBoundingBox and return NULL_AABB to make the tile entity render at all times (when you are not looking at it).

Expand  

When I do that it gives NullPointerException.

Posted (edited)

That should be impossible. Show your code.

 

Note that NULL_AABB might had been renamed to INFINITE_EXTENT_AABB.

Edited by DavidM

Some tips:

  Reveal hidden contents

 

Posted

Is there something I can do to make this work?

It renders properly even if I'm not looking at the TE, but only when I'm in the same chunk as TE.

 

My code:

  Reveal hidden contents
  Reveal hidden contents

I know it's not well optimised, but for now I'm just trying to make this work.

Posted
  On 8/22/2019 at 7:52 PM, xxTFxx said:

but only when I'm in the same chunk as TE.

Expand  

You also need to override TileEntity#getMaxRenderDIstanceSquared for reference the Beacon returns a value of 65536.0D

  • Thanks 1

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
  On 8/22/2019 at 8:52 PM, xxTFxx said:

Ok, I've tested it and it also works only when I'm looking at the TE.

Expand  

Did you change the bounding box away from INFINITE_EXTENT_AABB? Because otherwise it should assume you are always looking at 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.

Posted

This might not help (sorry) but I have a TESR which draws long tracks which used to disappear when looked at from a certain angle, with the block off the screen. That was only fixed by overriding isGlobalRenderer, returning true. This might hurt performance if you plan to have a lot of these blocks but I didn't have any problems with about 50 of those blocks on the screen (didn't try any higher).

Posted
  On 8/22/2019 at 9:28 PM, FredTargaryen said:

This might not help (sorry) but I have a TESR which draws long tracks which used to disappear when looked at from a certain angle, with the block off the screen. That was only fixed by overriding isGlobalRenderer, returning true. This might hurt performance if you plan to have a lot of these blocks but I didn't have any problems with about 50 of those blocks on the screen (didn't try any higher).

Expand  

Thanks, that did actually helped.

Posted
  On 8/22/2019 at 8:52 PM, xxTFxx said:

Ok, I've tested it and it also works only when I'm looking at the TE.

Expand  

This is also what the TileEntityBeaconRenderer does ???

  On 8/22/2019 at 9:28 PM, FredTargaryen said:

This might not help (sorry) but I have a TESR which draws long tracks which used to disappear when looked at from a certain angle, with the block off the screen. That was only fixed by overriding isGlobalRenderer, returning true. This might hurt performance if you plan to have a lot of these blocks but I didn't have any problems with about 50 of those blocks on the screen (didn't try any higher).

Expand  

 

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.

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.