Jump to content

[1.7.10] Render a block without using metadata


tyker1

Recommended Posts

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.

Link to comment
Share on other sites

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) :(

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.