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

As part of my mod, I am using world.setBlockToAir, but it is not updating that the block is no longer there on the client.  I run the server and connect two clients, one that initiates the method on which it works fine, but the other client still sees the block as there.  I can still stand on it until the server kicks the client for "flying".

 

I have already tried world.markAndNotifyBlock but I am guessing it isn't doing what I thought it would.

  • Author

It should be setting it both on the client and server.

world.setBlockToAir(pos);
world.notifyNeighborsOfStateChange(pos, null);
world.markAndNotifyBlock(pos, world.getChunkFromBlockCoords(pos), world.getBlockState(pos), world.getBlockState(pos), 0);
world.playSound(player, pos, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F);

This should be called on server. Idk if you even should touch notify stuff.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

I assume you mean the markAndNotifyBlock method as the notifiyNeighborsOfStateChange seems necessary​ so that adjacent blocks will properly update when the one gets removed.

If you only want to set block to air - you only need to call exacly that method and ONLY on server.

Other methods are not what you may think.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Calling it only on the server and removing all mark methods still only updates on the one client and only causes block updates if in multiplayer.

  • Author

Am I being dumb, am I using isRemote backwards or what is wrong, I still am not seeing it.

TileEntity should (almost?) never be removed on demand. Leave that to internals.

 

Basically - wrap every damn thing in !world.isRemote. From start to end.

2nd - TAKE CARE OF YOUR RETURN! You can't just place null there.

 

Also:

Block selectedBlock = world.getBlockState(pos).getBlock();
                if (!selectedBlock.equals(Blocks.BEDROCK)) {
IBlockState block = world.getBlockState(pos);

Really?

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Ok.

Yea, thought of that after, fixing.

Still in progress, on the list of things to do.

I realized that after uploading, fixed now.

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.