Posted July 28, 20178 yr I have a block type with several instances that have different properties which I set in the constructor. I want the IPropertys that go into the BlockStateContainer to be dependent on the constructor parameters (nothing else needs to be overriden so I don't have subclasses), but createBlockState is called in the Block super constructor so that doesn't work. Is there any other way I can achieve this without having to manually override createBlockState for every instance of my block?
July 28, 20178 yr Author I have a sort of workaround. I'm constructing my own BlockStateContainer in my constructor (using my parameters), and then overriding getBlockState to return mine instead of Block#blockState. Although I also have to check if mine is null (meaning the method is being called from the super constructor) and return the default version if that's the case (which will then be ignored, but otherwise the super constructor throws an NPE). It's messy but, still less messy than making 10+ subclasses to override one method.
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.