Jump to content

[1.15.2] How to update properties/textures a custom block dynamically?


Recommended Posts

Posted

Hello, everyone.

 

I searched in the forum about that, but i didn't find similar topics. So i decided to ask.

 

I'm trying to do a bunch of things that i still don't know if it is possible for Blocks.

Basically, i need to make the block changes it's own properties/instance variables/textures dynamically, based in some conditions.

 

- Is each block posted in the world a completely new instance of it's class?

- Is it possible for the same block already posted to keep being updated constantly?

- I don't want to make the block keep values after it being broke, but in i'll need to manipulate variables while it exists in the world.

 

 

Posted
  On 6/14/2020 at 11:44 PM, Kriptarus said:

- Is each block posted in the world a completely new instance of it's class?

Expand  

No.

 

  On 6/14/2020 at 11:44 PM, Kriptarus said:

- Is it possible for the same block already posted to keep being updated constantly?

- I don't want to make the block keep values after it being broke, but in i'll need to manipulate variables while it exists in the world.

Expand  

Yes and yes.

 

Check out TileEntity and ITickableTileEntity.

  • Thanks 1

Some tips:

  Reveal hidden contents

 

Posted

I researched for TileEntity and ITickableTileEntity, and i made it work with my custom block.

 

But i still trying to update textures, properties, redstone power, ligth according some conditions.
I was thinking in use TileEntityRender, is that the only option? Is there some simple examples using it?

 

 

Posted
  On 6/22/2020 at 5:28 PM, Kriptarus said:

I researched for TileEntity and ITickableTileEntity, and i made it work with my custom block.

 

But i still trying to update textures, properties, redstone power, ligth according some conditions.
I was thinking in use TileEntityRender, is that the only option? Is there some simple examples using it?

 

 

Expand  

You do not need TESR if the conditions are trivial (i.e. redstone power, light, etc). Check out block state properties and model variants.

You might also want to look at vanilla redstone lamp or fence for examples.

Some tips:

  Reveal hidden contents

 

Posted
  On 6/23/2020 at 12:02 AM, DavidM said:

You do not need TESR if the conditions are trivial (i.e. redstone power, light, etc). Check out block state properties and model variants.

You might also want to look at vanilla redstone lamp or fence for examples.

Expand  

Thanks, i'll take a look. Seems the DayLightDetector works very similar Lamps too.

 

  On 6/23/2020 at 12:05 AM, TheGreyGhost said:

This working example tutorial project has a number of examples on how to render blocks using block models and how to render blocks using TER

https://github.com/TheGreyGhost/MinecraftByExample

Expand  

That's a lot of good stuff in your project! Thanks.

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.