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 am in the process of converting my existing blockstate based model to a tileentity due to excessive use of blockstates (4-value EnumProperty for each direction = 4096 + waterlogged = 8192 permutations!)

I have an existing (generated) multipart blockstate json, is there any way to easily convert it to the same model, just using the data from the tileentity instead of the blockstate?

 

I'm assuming I need to create a custom BakedModel, but I would ideally like to keep the current data-driven approach (one model for each of the 4 enum values).

 

It's the first time I've started looking into custom models, and I think a TileEntityRenderer is overkill for static models. Please correct me if I'm wrong.

  • Author

Perfect, thank you.

I'll give that a go and return if I run into any issues.

  • Author

Almost fully working.

Only thing I'm now struggling with is forcing my TileEntity to sync.

I'm calling markDirty and requestModelDataUpdate after changing the property, but the client side data doesn't refresh until I close and reopen the world.

Do I need to send a custom packet, or is there an easier way of forcing a resync?

  • Author

Even closer now.

I do not want to update neighbours, as the property is changed from Block#neighborChanged, and I do not want to cause an infinite loop.

//Called after updating property
BlockState blockState = getBlockState();
//Do not update neighbours
getWorld().notifyBlockUpdate(getPos(), blockState, blockState, Constants.BlockFlags.BLOCK_UPDATE | Constants.BlockFlags.RERENDER_MAIN_THREAD); 
requestModelDataUpdate();

I also call requestModelDataUpdate at the end of handleUpdateTag.

The data is now correct on the client (displayed when right clicked), but the render is always 1 step behind (Only updates once another block is placed).

  • Author
11 hours ago, diesieben07 said:

Call requestModelDataUpdate client-side

 

11 hours ago, Alpvax said:

the end of handleUpdateTag

I already do call it client side.

I have now removed the server side call, but nothing has changed.

  • Author

I saw, thank you.

I'll hopefully test it tomorrow, but it looks good.

I've never managed to get my head around this, so thanks for helping.

Edited by Alpvax

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.