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

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

  • Author

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.

  • Author

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

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.