Jump to content

Recommended Posts

Posted

I have an item which turns blocks, if they are of a certain Material and do not have TileEntities, into a new block. This block should then render a special model which consists of the old block's model and a special addition. To get the block's model, I want to use the block's registry name. This String is stored in the TileEntity's NBT data but for the rendering I need an IBlockState with the registry name as a property. To save me from having to create an enormous Enum with every block people want to use the item on, I want to create a PropertyString. How can/should I do this?

Posted

I searched for something else and found a way to do this as an unlisted property in one of TGG's MBE tutorials. Now my problem is how to get the block's model the way I wnat it to be. If I search the block in the GameRegistry I need a modid, if I search for the block via Blocks.getBlockByName() I can only get the default state. So I changed my property to save an IBlockState but I couldn't find any way of storing this in my tile entity. Is this even possible?

Posted

So I should save the registry name and the metadata to nbt and then get the block from the registry via Block.getBlockFromName(name) and get the state from the saved meta via blockInstance.getStateFromMeta(meta), right?

Posted

Now the block itself is working but i have got another problem now. I am replaing the baked model which is retrieved from a JSON file in the ModelBakeEvent with an ISmartBlockModel. In the handleBlockStates method I am returning a new instance of an IBakedModel. I am passing two IBakedModels to its constructor, one of them is a normal cube and the other one is the model I mentioned before which gets replaced. My problem is that my custom model has an orientation. I tried to circumvent this problem by creating new BakedQuads from the data I can retrieve from the original BakedQuads. But I am crashing with an IndezOutOfBoundsException: Size 0 although a Sysout tells me that the List of BakedQuads from getFaceQuads(EnumFacing.SOUTH) is of size 1 (which should be the case because there is a box in the model). What could be causing this? Is there any other way of rotating a premade model in code?

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.