Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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?

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?

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?

Ok, thank you.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.