Posted January 19, 20196 yr I have the following class (Scala). class ItemMyItem extends Item { setRegistryName("my_item") setUnlocalizedName("my_item") maxStackSize = 1 setCreativeTab(CreativeTabs.TOOLS) def spawnParticles(world: World, pos: BlockPos): Unit = { for (_ <- 1 to 50000) { val randX = Random.nextDouble() val randZ = Random.nextDouble() val randPlusX = Random.nextBoolean() val randPlusY = Random.nextBoolean() val randPlusZ = Random.nextBoolean() val d0 = pos.getX + 20.0 * (if (randPlusX) randX else -randX) val d1 = pos.getY + (if (randPlusY) randX else -randX) * 6.0 / 16.0 val d2 = pos.getZ + 20.0 * (if (randPlusZ) randZ else -randZ) world.spawnParticle(EnumParticleTypes.PORTAL, d0, d1, d2, 20.0 * (if (randPlusX) randX else -randX), 1.0, 20.0 * (if (randPlusZ) randZ else -randZ)) } } override def itemInteractionForEntity(stack: ItemStack, playerIn: EntityPlayer, target: EntityLivingBase, hand: EnumHand): Boolean = { super.itemInteractionForEntity(stack, playerIn, target, hand) playerIn.playSound(MyMod.mySound, 1.0F, 1.0F) spawnParticles(playerIn.getEntityWorld, playerIn.getPosition) true } } The problem is that when I test in multiplayer, only the person using the item can see the particles and hear the sound. They can see the arm swing animation on use. I was wondering why that was, and how I could get other players to see/hear them. Only on the client proxy do I register the sound. I am using vanilla particles, so I don't ever register those. I checked the docs and they seem to suggest it should be run on both sides automatically. Any help would be appreciated.
January 19, 20196 yr Author Thank you very much. I will check how to use packets. For the sound, I still can't get it to work right now. I'll post back if I figure it out.
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.