Posted October 11, 20169 yr 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?
October 11, 20169 yr 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()).
October 12, 20169 yr Author Works nicely, thanks One very minor note: it's StateMap.Builder rather than StateMapBase.Builder .
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.