Jump to content

[1.10.2] IUnlistedProperty question


desht

Recommended Posts

The background: I have a tile entity which can sometimes (depending on how it's configured by the player) be a redstone power provider, and sometimes (probably more commonly) not.

 

When it's a power provider, I obviously want Block#canProvidePower() to return true.  But when it isn't a power provider, I want that method to return false (having it return true messes up things like propagating a strong redstone signal).

 

Now, canProvidePower() only takes an IBlockState parameter, so I don't have access to the tile entity to see if it's currently able to provide power.  Therefore I figured I'd probably need to store ability that in the blockstate, i.e. have the tile entity update a boolean property of the block when its ability to provide power is toggled.

 

I don't want to use a regular listed block property, because a) this property has no bearing on the rendering of the block, and b) I already have several listed properties which do affect the rendering, and I don't want to double the number of models by adding another boolean property.

 

So, my question: is IUnlistedProperty the right way to go here?  My research so far suggests that it's really intended (along with Block#getExtendedState) only for block rendering, so would this be an appropriate usage?  Or is there a better way to do this?

Link to comment
Share on other sites

No, you should use the normal PropertyBool and in your ClientProxy in PreInit you need to call ModelLoader.setCustomStateMapper(yourBlockInstance, new StateMapBase.Builder.ignore(booleanPropertyToIgnore).build()).

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.