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.

Changes to world don't pass to other clients. [1.7.10 - 10.13.1.1219]

Featured Replies

Posted

I have an item that smelts blocks in world on right click, but the changes to the blocks don't get sent to other clients. If, for instance, I right click an iron ore block, it turns into an iron ingot, but other players still see an iron ore block (but the ingot is there) until they reload the chunks.

 

Here is the method that changes the block. It is called when !world.isRemote

 

 

public boolean convertBlock(int x, int y, int z, ItemStack tablet, World world, EntityPlayer player){
	Block target = world.getBlock(x, y, z);
	ItemStack smeltingResult = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(target, 1));
	if(smeltingResult == null) return false;
	if(smeltingResult.getItem() instanceof ItemBlock){
		Block block = Block.getBlockFromItem(smeltingResult.getItem());
		world.setBlock(x, y, z, block);
		world.notifyBlocksOfNeighborChange(x, y, z, block);
		return true;
	} else {
		int count = 1;
		count += Util.getLevelOfEnchantment(tablet, Enchantment.fortune);
		EntityItem ei = new EntityItem(world, x + 0.5, y + 0.5, z + 0.5, new ItemStack(smeltingResult.getItem(), count, smeltingResult.getItemDamage()));
		world.setBlockToAir(x, y, z);
		world.notifyBlocksOfNeighborChange(x, y, z, Blocks.air);
		world.spawnEntityInWorld(ei);
		count -= Util.getLevelOfEnchantment(tablet, Enchantment.unbreaking);
		if(!player.capabilities.isCreativeMode && count > 0) tablet.damageItem(count, player);

		return true;
	}
}

 

 

 

Any help is greatly appreciated!

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.