Jump to content

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


Recommended Posts

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);
		count -= Util.getLevelOfEnchantment(tablet, Enchantment.unbreaking);
		if(!player.capabilities.isCreativeMode && count > 0) tablet.damageItem(count, player);

		return true;




Any help is greatly appreciated!

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.

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.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.