Posted October 6, 201411 yr 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.