[1.16.4]
Hello, I'm pretty new to forge modding.
Recently I made a mod that spawns particles when player jumps with specific suite of armour, and it certainly shows particles in multi player mode,
but other players said they can't see them.
(Using LivingJumpEvent)
I also made a mod which spawns particles when player swing a special sword, but everyone can see the particles. (Using SwordItem.onEntitySwing)
I don't quite get difference between those two. Can anyone tell me why there's gap on those?
Here's the event subscriber for jump event:
@Mod.EventBusSubscriber
public static class ClientEvents {
@SubscribeEvent
public static void onJumping(final LivingEvent.LivingJumpEvent event) {
LivingEntity player = event.getEntityLiving();
World world = player.getEntityWorld();
if (world.isRemote && isPlayerWearingTheArmours(player)) {
ClientWorld clientWorld = (ClientWorld) world;
for (int i = 0; i < 15; ++i) {
clientWorld.addParticle(ParticleTypes.PORTAL, player.getPosXRandom(0.2D),
player.getPosYRandom() - 0.25D, player.getPosZRandom(0.2D),
(clientWorld.rand.nextDouble() - 0.25D) * 2.0D, -clientWorld.rand.nextDouble(),
(clientWorld.rand.nextDouble() - 0.25D) * 2.0D);
}
}
}
}
Thank you very much in advance!
Funyaah