Jump to content

[1.7.10] TileEntity.shouldRefresh called on client only.


Recommended Posts

Posted

Hello everybody.

This is really strange bug i have discovered:

Whenever i destroy my tileentity, it's destrcution should be logged, but it is not. After further testing, i came with fact that shouldRefresh is called on client only.

Using following code:

@Override
public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z) {
	boolean b = super.shouldRefresh(oldBlock, newBlock, oldMeta, newMeta, world, x, y, z);
	if(b){
		System.out.print("Invalidating on " + (worldObj.isRemote ? "CLIENT" : "SERVER"));
		TeleplatesManager.invalidate(teleplate);
	}
	return b;
}

I got only this in console ("Invalidating 0" is from TeleplatesManager.invalidate method):

Invalidating on CLIENT[12:48:05] [Client thread/INFO] [Teleplates Manager]: Invalidating 0

And this gives me problems, because i want to invalidate tileentity from my mapping whenever it gets destroyed.

Does anybody know why this happens?

 

Thanks for help!

If you have any questions - just ask!

 

EDIT: Note: my te extends TileEntity, so

b

is true on server too in this case.

Posted

how are you destroying your TE? Maybe you can call a method on your te on server side just before destroying it?

In creative. Using left click. And this method description specifies that it's called whenever tes block is being replaced. And destroying is basically replacing with air.

Posted

This is not what shouldRefresh is for. Use breakBlock in your Block class.

Thanks! It works... I knew that i could use breakBlock anyways, but i just was not sure why this is called only on client... This little thing confused me:

determines if this tile entity should be re-created when the ID, or Metadata changes.

...

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.