@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