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

Hello, it's me again :)

 

just now i have finished an ISBRH to render my block(in order to make it always point to the direction it was placed), cause this block itself has 8 states(each has one unique icon), i have decided to use metadata for these 8 icon and make a TileEntity to store the blocks orientation and other infos.

 

So there comes the problem. The block dose get rendered correctly when i place them, but after i restarted the server, its orientation get reset.

I have figured out, that minecraft will render a block before its tileentity read the infos from NBT, so that i always get 0(orientation -- south) after restarted the server.

 

Are there anyway that i can force my block to re-render after its tileentity has loaded all the infos from NBT?

 

i have tried updateTick method in my block class, but it seems it never be called. i also tried to use worldObj.markBlockForUpdate() as well as MineCraft.getMinecraft().renderGlobal.markBlockForRenderUpdate() at the end of readFromNBT method in my tileentity, but all i've got is nullPointerException :(

 

are there anyway to do this? or i must put orientation info in metadata in order to get it work?

 

Thx for help.

You should worldObj.markBlockForUpdate() with appropriate flag.

I think I used 3 and worked well.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

You should worldObj.markBlockForUpdate() with appropriate flag.

I think I used 3 and worked well.

 

what i get from worldObj.markBlockForUpdate() is only 3 parameter, which ,i guess, is the coordinate of the block to update...how can i set flag?

 

also another question is, where should i put this command? when i put it at the end of readFromNBT, it throws a NullPointerException, should i use a flag and then put this command in updateEntity? or maybe use worldObj.scheduledBlockUpdate?

 

have tried these in updateEntity, and nothing happens(well it do be called each tick, but block is not re-rendered) :(

Oh; Just worldObj#markBlockForUpdate() worked for me.

It should update rendering.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

yep, i figured out the actual problem... this tileentity is not synchronized after server restart lol... client side always get a new tileentity with new compound so its always blank... well, so its actually the problem, how to synchronize tileentity after server restart lol

Did you implement getDescriptionPacket and onDataPacket?

Then calling worldObj#markBlockForUpdate() from server will synchronize the block and update rendering.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

  • Author

Did you implement getDescriptionPacket and onDataPacket?

Then calling worldObj#markBlockForUpdate() from server will synchronize the block and update rendering.

 

ill have a try thx for helping :)

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.