#What is the actual difference between these commands (particles)

3 messages · Page 1 of 1 (latest)

void lion
#
@Override
    public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
        if(world.isClient()) {
            //ArcanistsParagon.LOGGER.info("Scionbloom right-clicked! charges=" + this.getCharges(state));
            world.addParticle(ParticleTypes.ANGRY_VILLAGER, pos.getX(), pos.getY(), pos.getZ(), 0.0, 0.0, 0.0);
        }
        return ActionResult.SUCCESS;
    }

    @Override
    public void onEntityCollision(BlockState state, World world, BlockPos pos, Entity entity) {
        if(!world.isClient()){
            (other code here)
                    }
                    else{
                        ServerWorld server = (ServerWorld) world;
                        Vec3d vec = new Vec3d(pos.getX(), pos.getY(), pos.getZ());
                        server.spawnParticles(new DustParticleEffect(new Vector3f((float) 30/256, (float) 30 /256, (float) 30 /256), 1.0f),
                                pos.getX(), pos.getY(), pos.getZ(), 20, 1.0f, 1.0f, 1.0f, 0.0f);

                        server.playSound(entity, pos, SoundEvents.BLOCK_BASALT_BREAK, SoundCategory.PLAYERS, 1.0f, 2.0f);
                        world.setBlockState(pos, Blocks.AIR.getDefaultState());
                    }
                }


            }
        }
    }

this is my code, and both work fine

#

what is the actual difference between clientside particle rendering and serverside rendering? I'm using clientside in the onUse and serverside in onEntityCollision correct?

crystal ingot
#

You should prefer client side when possible. It gives you more control over the particle. The server side option also causes a packet to be sent, which can cause issues if it happens really often